home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / buletq10.zip / CZ.HLP (.txt) < prev    next >
CZ Help  |  1992-05-31  |  217KB  |  3,854 lines

  1. CZ_HELP!
  2. INDEX
  3. TUTORIAL_INDEX
  4. LICENSE_AGREEMEN
  5. LICENSE_A
  6. PRODUCT_SUPPORT
  7. STARTING_CZ
  8. USING_CZ
  9. USING_CZ_A
  10. USING_CZ_B
  11. ABOUT_CZ
  12. IS_BULLET
  13. IS_A_DATABASE
  14. IS_DBF
  15. IS_A_BTREE
  16. IS_A_NETWORK
  17. IS_FILE_LOCKING
  18. IS_NLS
  19. DESIGN_A_DB
  20. CREATE_A_DB
  21. ADD_TO_THE_DB
  22. QUERY_THE_DB
  23. UPDATE_THE_DB
  24. DELETE_A_RECORD
  25. BC_COMPILE_WITH
  26. LIB_WITH
  27. MAKE_A_QLB
  28. LINK_WITH
  29. CALLING_BULLET
  30. SPECS_OVERALL
  31. SPECS_DBF
  32. SPECS_DBF_A
  33. SPECS_DBF_B
  34. SPECS_DBF_C
  35. SPECS_INDEX
  36. SPECS_INDEX_A
  37. SPECS_INDEX_B
  38. SPECS_INDEX_C
  39. SPECS_MEMORY
  40. SPECS_MEMORY_A
  41. SPECS_OS_CALLS
  42. SPECS_LANGUAGES
  43. SPECS_OSES
  44. SPECS_NETWORKS
  45. SPECS_PERFORMANC.
  46. SPECS_PERF_A
  47. SPECS_PERF_B
  48. SPECS_PERF_C
  49. SPECS_PERF_D
  50. INITXB
  51. EXITXB
  52. ATEXITXB
  53. MEMORYXB
  54. BREAKXB
  55. BACKUPFILEXB
  56. STATHANDLEXB
  57. GETEXTERRORXB
  58. DVMONCXB
  59. CREATEDXB
  60. OPENDXB
  61. CLOSEDXB
  62. STATDXB
  63. READDHXB
  64. FLUSHDHXB
  65. COPYDHXB
  66. ZAPDHXB
  67. CREATEKXB
  68. CREATEKXB_A
  69. CREATEKXB_B
  70. CREATEKXB_C
  71. CREATEKXB_D
  72. CREATEKXB_E
  73. CREATEKXB_F
  74. OPENKXB
  75. CLOSEKXB
  76. STATKXB
  77. READKHXB
  78. FLUSHKHXB
  79. COPYKHXB
  80. ZAPKHXB
  81. GETDESCRIPTORXB
  82. GETRECORDXB
  83. ADDRECORDXB
  84. UPDATERECORDXB
  85. DELETERECORDXB
  86. UNDELETERECORDXBep
  87. PACKRECORDSXB
  88. FIRSTKEYXB
  89. EQUALKEYXB
  90. NEXTKEYXB
  91. PREVKEYXB
  92. LASTKEYXB
  93. STOREKEYXB
  94. DELETEKEYXB
  95. BUILDKEYXB
  96. CURRENTKEYXB
  97. GETFIRSTXB
  98. GETEQUALXB
  99. GETNEXTXB
  100. GETPREVXB
  101. GETLASTXB
  102. INSERTXB
  103. UPDATEXB
  104. REINDEXXB
  105. LOCKXB
  106. UNLOCKXB
  107. LOCKKEYXB
  108. UNLOCKKEYXB
  109. LOCKDATAXB
  110. UNLOCKDATAXB
  111. DRIVEREMOTEXB
  112. FILEREMOTEXB
  113. SETRETRIESXB
  114. DELETEFILEDOS
  115. RENAMEFILEDOS
  116. CREATEFILEDOS
  117. ACCESSFILEDOS
  118. OPENFILEDOS
  119. SEEKFILEDOS
  120. READFILEDOS
  121. EXPANDFILEDOS
  122. WRITEFILEDOS
  123. CLOSEFILEDOS
  124. MAKEDIRDOS
  125. ACCESSPACK
  126. BREAKPACK
  127. COPYPACK
  128. CREATEDATAPACK
  129. CREATEKEYPACK
  130. DESCRIPTORPACK
  131. DOSFILEPACK
  132. DVMONPACK
  133. EXITPACK
  134. FIELDDESCTYPE
  135. HANDLEPACK
  136. INITPACK
  137. MEMORYPACK
  138. OPENPACK
  139. REMOTEPACK
  140. SETRETRIESPACK
  141. STATDATAPACK
  142. STATKEYPACK
  143. STATHANDLEPACK
  144. XERRORPACK
  145. ERRORS_BULLET
  146. ERRORS_BULLET_B
  147. ERRORS_BULLET_C
  148. ERRORS_BULLET_D
  149. ERRORS_BASIC
  150. ERRORS_BASIC_B
  151. ERRORS_DOS
  152. ERRORS_DOS_B
  153. ERRORS_DOS_C
  154. INITXBSRC
  155. EXITXBSRC
  156. ATEXITXBSRC
  157. MEMORYXBSRC
  158. BREAKXBSRC
  159. BACKUPFILEXBSRC
  160. STATHANDLEXBSRC
  161. GETEXTERRORXBSRC
  162. DVMONCXBSRC
  163. CREATEDXBSRC
  164. CREATEDXBSRC_A
  165. OPENDXBSRC
  166. CLOSEDXBSRC
  167. STATDXBSRC
  168. READDHXBSRC
  169. FLUSHDHXBSRC
  170. COPYDHXBSRC
  171. ZAPDHXBSRC
  172. CREATEKXBSRC
  173. CREATEKXBSRC_A
  174. OPENKXBSRC
  175. CLOSEKXBSRC
  176. STATKXBSRC
  177. READKHXBSRC
  178. FLUSHKHXBSRC
  179. COPYKHXBSRC
  180. ZAPKHXBSRC
  181. GETDESCRIPTORXBS"
  182. GETRECORDXBSRC
  183. ADDRECORDXBSRC
  184. UPDATERECORDXBSR
  185. DELETERECORDXBSR1
  186. UNDELETERECORDSR
  187. PACKRECORDSXBSRC
  188. FIRSTKEYXBSRC
  189. EQUALKEYXBSRC
  190. NEXTKEYXBSRC
  191. PREVKEYXBSRC
  192. LASTKEYXBSRC
  193. STOREKEYXBSRC
  194. DELETEKEYXBSRC
  195. BUILDKEYXBSRC
  196. CURRENTKEYXBSRC
  197. GETFIRSTXBSRC
  198. GETEQUALXBSRC
  199. GETNEXTXBSRC
  200. GETPREVXBSRC
  201. GETLASTXBSRC
  202. INSERTXBSRC
  203. UPDATEXBSRC
  204. REINDEXXBSRC
  205. LOCKXBSRC
  206. UNLOCKXBSRC
  207. LOCKKEYXBSRC
  208. UNLOCKKEYXBSRC
  209. LOCKDATAXBSRC
  210. UNLOCKDATAXBSRC
  211. DRIVEREMOTEXBSRCS 
  212. FILEREMOTEXBSRC
  213. SETRETRIESXBSRC
  214. DELETEFILEDOSSRCa&
  215. RENAMEFILEDOSSRC
  216. CREATEFILEDOSSRC
  217. ACCESSFILEDOSSRC
  218. OPENFILEDOSSRC
  219. SEEKFILEDOSSRC
  220. READFILEDOSSRC
  221. EXPANDFILEDOSSRC
  222. WRITEFILEDOSSRC
  223. CLOSEFILEDOSSRC
  224. MAKEDIRDOSSRC
  225. ~INDEX            CZ.HLP-BULLET for QB/BASIC PDS
  226.  System 
  227.  Mid-level Record/Key Access 
  228. InitXB        
  229. CreateDXB    CreateKXB    GetDescriptorXB     FirstKeyXB     
  230. ExitXB        
  231. OpenDXB      OpenKXB      GetRecordXB         EqualKeyXB     
  232. AtExitXB      
  233. CloseDXB     CloseKXB     AddRecordXB         NextKeyXB      
  234. MemoryXB      
  235. StatDXB      StatKXB      UpdateRecordXB      PrevKeyXB      
  236. BreakXB       
  237. ReadDHXB     ReadKHXB     DeleteRecordXB      LastKeyXB      
  238. BackupFileXB  
  239. FlushDHXB    FlushKHXB    UndeleteRecordXB    StoreKeyXB     
  240. StatHandleXB  
  241. CopyDHXB     CopyKHXB     PackRecordsXB       DeleteKeyXB    
  242. GetExtErrorXB 
  243. ZapDHXB      ZapKHXB                          BuildKeyXB     
  244. DVmonCXB      
  245.                                               CurrentKeyXB   
  246.  High-level Access 
  247.  Network 
  248. GetFirstXB    InsertXB     
  249. LockXB           UnlockXB        LockKeyXB      
  250. GetEqualXB    UpdateXB     
  251. UnlockKeyXB      LockDataXB      UnlockDataXB   
  252. GetNextXB     ReindexXB    
  253. DriveRemoteXB    FileRemoteXB    SetRetriesXB   
  254. GetPrevXB                  
  255. GetLastXB                  
  256.  Low-level DOS Access 
  257.                            
  258. DeleteFileDOS    OpenFileDOS     WriteFileDOS   
  259.                            
  260. RenameFileDOS    SeekFileDOS     CloseFileDOS   
  261.  Move cursor to index item 
  262. CreateFileDOS    ReadFileDOS     MakeDirDOS     
  263.  and press <Enter>.        
  264. AccessFileDOS    ExpandFileDOS                  
  265. See: TUTORIAL_INDEX
  266. ~TUTORIAL_INDEX   CZ.HLP-BULLET for QB/BASIC PDS
  267.  CZ.COM 
  268.  Using BULLET 
  269.  1.00 
  270. Starting_CZ   
  271. What:              How to:                                   
  272. Using_CZ      
  273.  is_BULLET          design_a_DB         BC_compile_with      
  274. About_CZ      
  275.  is_a_database      create_a_DB         LINK_with            
  276.               
  277.  is_DBF             add_to_the_DB       LIB_with             
  278.  is_a_Btree         query_the_DB        make_a_QLB           
  279.  Error Codes
  280.  is_a_network       update_the_DB                            
  281. Errors_BULLET 
  282.  is_file_locking    delete_a_record     calling_BULLET       
  283. Errors_BASIC  
  284.  is_NLS                                                      
  285. Errors_DOS    
  286.                     LICENSE_AGREEMENT   Product_Support      
  287.  Structure Pack Types 
  288.  Specifications 
  289. AccessPack       DVmonPack        RemotePack     
  290. Specs_Overall            
  291. BreakPack        ExitPack         SetRetriesPack 
  292. Specs_DBF                
  293. CopyPack         FieldDescTYPE    StatDataPack   
  294. Specs_Index              
  295. CreateDataPack   HandlePack       StatKeyPack    
  296. Specs_Memory             
  297. CreateKeyPack    InitPack         StatHandlePack 
  298. Specs_OS_Calls           
  299. DescriptorPack   MemoryPack       XErrorPack     
  300. Specs_Languages          
  301. DOSFilePack      OpenPack                        
  302. Specs_OSes               
  303.                                                  
  304. Specs_Networks           
  305.                                                  
  306. Specs_Performance        
  307. See: License_Agreement
  308. ~License_Agreement
  309. Before using this software you must agree to the following:
  310.  1. You are not allowed to operate more than one (1) copy of this software
  311.     package at one time per license. This means that if you have 10 programmers
  312.     that COULD possibly use the BULLET library at the same time, you must also
  313.     have ten (10) BULLET licenses.
  314.  2. You are not allowed to distribute non-executable code containing BULLET
  315.     code. This means that you are not allowed to redistribute BULLET code as
  316.     another .LIB, for example. Also, if BULLET code is to be contained in a
  317.     Dynamic Link Library (DLL) then it must be part of a stand-alone product.
  318.     This means that you cannot provide a .DLL containing BULLET code if that
  319.     .DLL is to be used as a programming library for other programmers. If you
  320.     wish to distribute non-executable code containing BULLET code you must
  321.     obtain written permission from the author.
  322.  3. This license grants you the right to use the BULLET library code on a
  323.     royalty-free basis.
  324. See: License_a                                                          -MORE-
  325. ~License_a
  326.  4. BULLET is owned by the author, Cornel Huth, and is protected by United
  327.     States copyright laws and international treaty provisions. You are not
  328.     allowed to make copies of this software except for archival purposes.
  329.  5. You may not rent or lease BULLET. You may not transfer this license without
  330.     the written permission of the author. If this software is an update or
  331.     upgrade, you may not sell or give away previous versions.
  332.  6. You may not reverse engineer, decompile, or disassemble this software.
  333.  7. There are no expressed or implied warranties with this software.
  334.  8. All liabilities in the use of this software rest with the user.
  335.  9. U.S. Government Restricted Rights. This software is provided with
  336.     restricted rights. Use, duplication, or disclosure by the Government is
  337.     subject to restrictions as set forth in subparagraph (c)(1)(ii) of the
  338.     Rights in Technical Data and Computer Software clause at 52.227-7013.
  339.     Manufacturer is Cornel Huth/6402 Ingram Rd/San Antonio, TX 78238.
  340.     This agreement is governed by the laws of the state of Texas.
  341. See: Product_Support
  342. ~Product_Support
  343. Phone support is available 7 days a week, 9AM-9PM Central Time (USA) for
  344. registered users. Phone support for non-registered users is not available.
  345. If you are a registered BULLET user you may call 1-512-684-8065 during the
  346. hours listed above. If I'm not available to handle your call leave a message
  347. on the machine briefly explaining the basis for your call. You MUST leave a
  348. message stating that you want the return call to be COLLECT. Calls cannot be
  349. returned unless you state this in your message (no exceptions).
  350. If you have a problem that you believe to be due to a bug in BULLET, mail a
  351. diskette with the program and data to recreate the problem. Include all source
  352. code, data files, libraries, etc. on the disk that is needed to recreate the
  353. problem. Do not send your entire application. Do not send only a listing. Send
  354. only the code that is sufficient for another person to recreate the problem.
  355. (No exceptions.)
  356. A support BBS is not currently available but is expected to be operational in
  357. the near future. If you would like to use a BBS to communicate you may reach me
  358. at NUL BBS, 1-512-615-6852 (2400+), 615-6851 and 6853 (9600+, HST, V.32bis) or
  359. you may contact me on FidoNet at Cornel Huth @ 1:387/800 or through Internet at
  360. Cornel.Huth@p8.f800.n387.z1.fidonet.org.
  361. See: Starting_CZ
  362. ~Starting_CZ
  363. At CZ's initial load it looks into the current directory for CZ.HLP, then in 
  364. the directory of CZ.COM, and last it looks for the pathname specified by the 
  365. DOS variable CZH (SET CZH=C:\DOC\CZ.HLP). Use /f: for alternate locations.   
  366. Load CZ.COM from the DOS command line. Options are:
  367.         /f:helpfile.ext       Use other than default CZ.HLP help file
  368.         /h# where n=1 to 4    Use alternate hot-key from default Alt-F1
  369.             #=1  Ctrl-h
  370.             #=2  F12
  371.             #=3  left+right Shift
  372.             #=4  Alt-left Shift
  373.         /u  uninstall CZ from memory (after initial load)
  374.         /s  temporarily put CZ to sleep by restoring all hooked vectors
  375.         /r  restore CZ from its sleep by rehooking vectors
  376.         /?  quick help
  377.  E.g., C>cz /f:D:\PRG_C\CBULLET.HLP   supply entire pathname when using /f:
  378.        C>cz /h1                       change hot key from Alt-F1 to Ctrl-H
  379. You can use the /f: at any time, even after the initial install, as all but /u.
  380. See: Using_CZ
  381. ~Using_CZ
  382. To activate CZ press the hot-key while the cursor is on the word you want to
  383. look up. Information on that word, if any, is displayed. If none is available,
  384. an index of help items in the dictionary is shown. Along the top-right of the
  385. index screens is the control bar. You can quickly move to the control bar by
  386. pressing <Home> or the See: line with <End>. Move the cursor to TUTORIAL_INDEX
  387. to select the second index screen or QUIT to return to whatever you were doing
  388. or over any index item. Then press <Enter> to move to that item's help entry.
  389. <F1> can be used as <Enter>. A mouse can also be used and is recommended.
  390. For example, to find out about CreateDXB, type it in your application and move
  391. the cursor on it. Press the hot-key. The CreateDXB screen is displayed. To see
  392. what pack type it uses, move to Pack: CreateDataPack and press <Enter>. For a
  393. source example, move the cursor to Src: CreateDXBsrc and press <Enter>. To go
  394. straight to the index from your application, press the hot-key with the cursor
  395. on a blank space. The <Esc> key returns you to your application.
  396. If there are more screens for the current topic the See: line has the same   
  397. topic name plus a letter, and -MORE- at the end. Move the cursor (or mouse)  
  398. to the topicname text (by using the <End> key) and press <Enter> (or click). 
  399. See: Using_CZ_a                                                         -MORE-
  400. ~Using_CZ_a
  401. CZ.COM can be loaded high but it is ESSENTIAL that you have at least 15K of  
  402. free UMB RAM available. It will load in as little as 4.5K but it will not    
  403. operate correctly. Use MEM/c to see how much Upper Memory RAM is available.  
  404. CZ opens the help file at installation. The help file is opened for Read-Only
  405. access with a Deny None sharing attribute. The file is closed when CZ is
  406. uninstalled (C>cz /u). CZ makes use of its own 256-byte stack.
  407. If you have several CZ help files, rename them to their particular application.
  408. For example:
  409. Rename the QuickBASIC BULLET CZ.HLP to QBULLET.HLP. Put QBULLET.HLP into your
  410. help files directory. Put SET CZH=C:\HELPFILES\QBULLET.HLP in your AUTOEXEC.BAT
  411. file. The next time CZ is installed it uses QBULLET.HLP from C:\HELPFILES.
  412. At anytime you can specify CZ.COM to use another help file. For example, if the
  413. current CZ help file is QBULLET.HLP but you want to use the CBULLET.HLP file,
  414. use C>cz /f:\helpfiles\cbullet.hlp. CBULLET.HLP then becomes the active file
  415. the next time you popup CZ.
  416. See: Using_CZ_b                                                         -MORE-
  417. ~Using_CZ_b
  418. Limitations:
  419. 1) The QB environment may interpret the Alt-F1 keypress after CZ has popped
  420. down. If this is a problem then change the hotkey, e.g., C>cz /h2 to use F12.
  421. 2) In the QB (and QBX) environment the keypad <Enter> key is not recognized by
  422. CZ. Use the main <Enter>. This does not occur in the QB 4.0x environment or
  423. in other editors.
  424. 3) If, after returning from CZ, the QB environment's menu bar does not respond
  425. to Alt-keys (like an Alt-F), click the left mouse button a few times, or press
  426. F6 to go to the immediate window and execute a SHELL. It's unlikely that you'll
  427. encounter this.
  428. 4) CZ is a stable TSR but like all TSRs in a DOS system, unforseen events can
  429. take place that could conceivably cause the computer to crash. Therefore, it's
  430. recommended that you save your work often (you should do so whether a TSR is
  431. installed or not).
  432. See: About_CZ
  433. ~About_CZ
  434.               
  435.               
  436.                      CZ HELP                     
  437.               
  438.                                                  
  439.               
  440.       Context-sensitive Online Help Manager      
  441.               
  442.                                                  
  443.               
  444.                      for the                     
  445.               
  446.                                                  
  447.               
  448.                
  449.               
  450.               
  451.                
  452.                
  453.               
  454.                
  455.                
  456.               
  457.                
  458.                
  459.               
  460.                                                  
  461.               
  462.                 compiler libraries               
  463.               
  464.                                                  
  465.               
  466.        MS-DOS QuickBASIC/BASIC PDS version       
  467.               
  468.         (available for most DOS compilers)       
  469.               
  470.                                                  
  471.               
  472.            Copyright 1992  Cornel Huth           
  473.               
  474.                                                  
  475.               
  476. Ver 1.00         INT2F MuxID=C2         31-May-92
  477.               
  478. See: Specs_Overall
  479. ~is_BULLET - What?
  480. BULLET is a program module that handles the details of putting information to
  481. and getting information from your hard disk using a standard data file format
  482. called the Xbase DBF format with very fast and efficient index file routines.
  483. It can be used as-is by most DOS compilers.
  484. BULLET is written in 100% assembly language. Why? Two reasons. First, control.
  485. There's no compiler code or run-time library code in between BULLET and your
  486. data. Second, efficiency. BULLET knows exactly what it requires from the
  487. operating system and when. Result: fast, small, and robust applications.
  488. See: is_a_database
  489. ~is_a_database - What?
  490. A database is a collection of data arranged so that the it can be accessed as
  491. useful information. For example, let's say we have two files. Each consists of
  492. two fields. The first file has codenumber and score. The second file has a
  493. codenumber and name. Separately, the files are merely a collection of data.
  494. Together, however, they tie the name to the score:
  495.         score codenumber   codenumber name
  496.          99     100           100     John
  497.          87     155           105     Paul
  498.          66     125           110     George
  499.           :      :             :       :
  500. Codenumber 100 is John, who scored 99. The other members scores are not in the
  501. abbreviated data file listing.
  502. A database can be a single data file but more often it is a group of related
  503. data files and usually these data files are indexed by keys (in the index file,
  504. also called key file) so that very fast, direct access is possible.
  505. See: is_DBF
  506. ~is_DBF - What?
  507. DBF is the file extension of dBASE III-compatible data files (filename.DBF).
  508. The file format is used by dBASE IV, FoxPro and many other database programs.
  509. Many programs can also use the file format to import/export data using it.
  510. The DBF format is the most common data file format used on PCs.
  511. A DBF-compatible data file consists 3 distinct areas. First is the data header.
  512. This contains information such as the number of records in the file. Second is
  513. the field descriptors. These descriptors define the makeup of each field in the
  514. record. The third is the record area. Each record is a logical unit of data.
  515. For example, a record, all of which are made up of the same fields but with
  516. different data, could (conceptually) look like this:
  517.                field 1         field 2         field 3       field n
  518.            
  519.   record 1 
  520. Johnson         
  521. Larry          
  522. 465310555     ...
  523.            
  524.   record 2 
  525. Aberdeen        
  526. Zara           
  527. 465230555     ...
  528.            
  529.   record n
  530. See: is_a_Btree  Specs_DBF
  531. ~is_a_Btree - What?
  532. A b-tree is a sorting method ideally suited to data structures maintained on a
  533. hard disk. It is very fast on retrieval and is inherently self-balancing during
  534. inserts and deletes. Self-balancing ensures performance remains consistent.
  535. The reason the b-tree is ideally suited to hard disks is that, when looking for
  536. a particular key, most of the time involved in accessing the key is spent by
  537. the hard drive moving to various locations on the disk. The task of a good
  538. access method is to reduce the number of seeks that the disk must perform. The
  539. b-tree accomplishes this by maintaining several keys (perhaps 50) on each node,
  540. with the necessary pointers to previous and following nodes. A b-tree of order
  541. 20 (19 keys per node) can find a key in a file of 1,000,000 keys in a MAXIMUM
  542. of 5 disk accesses, where each disk access visits a node.
  543. 'BASIC program to find *max* seeks needed/avg time
  544. Keys& = 1000000: KeysPerNode = 19: AvgSR = 25
  545. Order = KeysPerNode + 1
  546. max = (LOG((Keys& + 1) / 2) / LOG(Order / 2))
  547. PRINT "Max nodes accessed for"; Keys; "keys & b-tree of order"; Order;
  548. PRINT "is"; max; "nodes"
  549. PRINT "Max disk time based on avg seek+read of"; AvgSR;
  550. PRINT "ms is"; AvgSR / 1000 * max; "seconds"
  551. See: is_a_network  Specs_Index
  552. ~is_a_network - What?
  553. A network is a group of computers able to communicate with one another. Often
  554. called a LAN (local area network), a network allows resources to be shared.
  555. Sharing resources can lead to problems if steps are not taken to ensure that
  556. two computers don't try to share the same resource at the same time. For
  557. example, say two computers try to change the same record in a file on a network
  558. drive. Let's say both users are accessing the number of widgets in inventory.
  559. The first user gets there a micro-second before the second and allocates the
  560. last widget in stock. The second user comes in right after and, since the first
  561. user has not yet updated the inventory, allocates the very same widget. One
  562. widget, two users. When the first user updates the inventory, widgets in
  563. inventory is changed to 0 (previous - 1). The second updates the inventory in
  564. the same manner and sets widgets to 1 less what it was when it started, or 0
  565. also. You see the problem.
  566. In order to successfully share a file on a network, the file must first be
  567. locked to a single user. Once that user has locked the file, he has sole access
  568. to the data within it and he will not experience the scenario above. When the
  569. user has completed the changes, he unlocks the file so that others may use it.
  570. See: is_file_locking
  571. ~is_file_locking - What?
  572. File locking is a means to obtain exclusive access to a file. This is needed in
  573. cases of multiple programs or users accessing a shared file at the same time.
  574. There are several methods to ensure only one process or user has access to a
  575. file. The first method is to open the file so that while the file is open only
  576. your program can access any part of it. This is simple to implement and the
  577. operating system handles the details of this. However, it requires your program
  578. to open/close files all the time since no other process may access the file
  579. while it is open.
  580. Another method is to use byte-level locks. Also managed by the OS, this method
  581. allows for restricting access to any particular region within the file. Which
  582. regions are to be locked is to be determined by your program, however, and it
  583. can be complex to perform multiple locks at the byte, field, or record level.
  584. Another use of the byte-level lock is to specify that all bytes within the file
  585. are to be locked. This greatly simplifies the process of obtaining a lock and
  586. has the advantage over a file access lock of not needing to open/close the file
  587. for each lock. It is very fast and easy to implement. BULLET offers this and
  588. file access locking.
  589. See: is_NLS
  590. ~is_NLS - What?
  591. NLS stands for National Language Support. This feature is available in DOS 3.3
  592. and later. BULLET makes use of NLS by getting from DOS the current DOS country
  593. collate-sequence table. The collate table is used to properly sort mixed-case
  594. character strings and also foreign (or non-USA) language character strings
  595. according to that country's alphabet. This is an option but is recommended.
  596. In addition, BULLET provides for a programmer-supplied collate-sequence table.
  597. See: design_a_DB
  598. ~design_a_DB - How to
  599. To design a database, above all else, know what information you require from
  600. it. Having established what you need to know, collect the data that lets you
  601. formulate this into useful information.
  602. For example, you want to track a class of students and determine how well they
  603. achieve on tests. The criterion you use is the test score. You determine that
  604. your data is 1) students, 2) tests, and 3) test scores. Too simplify, you use
  605. a single 20-character field for student, a 1-character field for test number
  606. ("1" to the "n" tests), and a numeric field for test scores (0 to 100).
  607. Since the objective is to track students' scores, arrange the data so that
  608. output consists of each student's score in test order. Do this by specifying an
  609. index file containing an index based on the student's name and test number:
  610.   KeyExpression$ = "STUDENT + TEST"       'combine two character fields
  611. This is the reason that field 2, test number, is a character field. It can more
  612. easily be combined with other character fields than a numeric field. By using
  613. the routines of the database langauge, you can easily create the data and index
  614. files, add data, list student's scores, or make changes to the database. Note:
  615. these How_to examples are meant only to show the basis behind an operation.
  616. See: create_a_DB  CreateKXB
  617. ~create_a_DB - How to
  618. Having defined the database, create it. First, create the datafile based on the
  619. 3 fields you defined in your design. To do this, DIM an array for the field
  620. descriptors for the number of fields (see also CreateDataPack):
  621. DIM FD(1 TO 3) AS FieldDescTYPE
  622. FD(1).FieldName = "STUDENT" + STRING$(10,0)   'must be zero-filled
  623. FD(1).FieldType = "C"
  624. FD(1).FieldLength = CHR$(20)               
  625. FD(1).FieldDC = CHR$(0)                    
  626. The FD() is a structure element  
  627. FD(2).FieldName = "TEST" + STRING$(10,0)   
  628. in CDP (CreateDataPack) as in:   
  629. FD(2).FieldType = "C"                      
  630. CDP.Func=CREATEDXB               
  631. FD(2).FieldLength = CHR$(1)                
  632.   :        :                     
  633. FD(2).FieldDC = CHR$(0)                    
  634. CDP.FieldListPtrOff=VARPTR(FD(1))
  635. FD(3).FieldName = "SCORE" + STRING$(10,0)  
  636. CDP.FieldListPtrSeg=VARSEG(FD(1))
  637. FD(3).FieldType = "N"                      
  638.   :        :                     
  639. FD(3).FieldLength = CHR$(3)                
  640. FD(3).FieldDC = CHR$(0)
  641. Call CreateDXB to create the data file. To create the index file, first open
  642. the data file just created, then call CreateKXB to create the index file. Open
  643. the index file so we can use it (data file is already open).
  644. See: add_to_the_DB  CreateDXB
  645. ~add_to_the_DB - How to
  646. Once you have the database designed and the data and key files created and open
  647. you can start putting the student's test data into it. Note that the DBF-format
  648. requires that all data in a data file be in ASCII format. This means that we
  649. must convert the numeric test score into its ASCII form. BASIC has the STR$()
  650. function to do this. In addition, numbers generally should be right-justified
  651. in their field. BASIC has the RSET statement to do this:
  652. TYPE StudentRecordTYPE 'this structure is exactly how the record is on disk
  653. tag AS STRING * 1      'DBF delete tag used to identify deleted records
  654. sname AS STRING * 20   '--the tag is always present in any DBF record
  655. testn AS STRING * 1    '  don't forget to include it in all your TYPEs
  656. score AS STRING * 3
  657. END TYPE '25
  658. DIM SR AS StudentRecordTYPE
  659.      :
  660.    INPUT "Student name, test number, score:",n$,t$,s%
  661.    SR.sname = n$ : SR.testn = t$ : RSET SR.score = STR$(s%)
  662.    status = DoInsert(SR, keyhandle)
  663. LOOP UNTIL LEN(n$) = 0 OR (status <> 0)
  664. See: query_the_DB  InsertXB
  665. ~query_the_DB - How to
  666. Now that you have data in the database you want to see what's in there. Since
  667. the index file is in "STUDENT + TEST" order, the information we'll be getting
  668. out of the database is in Student name order, with each student's scores in
  669. test number order.
  670. If we want to look at all the students, we can use GetFirstXB to retrieve the
  671. first student's score for the first test. GetNextXB retrieves the next record
  672. (the first student's score for the second test), and so on. When all records
  673. have been retrieve GetNextXB returns an End Of File error code.
  674. If we want to look at a particular student's score only, we can use GetEqualXB
  675. to go directly to a student's first test score. GetNextXB get his next and so
  676. on until GetNextXB retrieves the next student's first test score. You can stop
  677. at this point (student names no longer match).
  678. We might also want to find all students who scored less than 65 on any test. To
  679. do this we can GetFirstXB, check SR.score for < 65 and if so print that record.
  680. Continue by using GetNextXB, printing each record that has a score < 65.
  681. See: update_the_DB  GetFirstXB
  682. ~update_the_DB - How to
  683. To update a particular record in the database we must first locate and identify
  684. it using one of the get routines such as GetEqualXB. The Get() routine return
  685. the record data, and also the physical record number of the record accessed,
  686. into the AccessPack RecNo. Having used one of the Get() routines to read the
  687. data record from disk to memory, you can make any changes to the data record in
  688. memory. E.g., if a student's score needs to be changed from a 69 to a 96, first
  689. find the record (and its RecNo), then update the score field:
  690.    INPUT "Student name, test number",n$,t$
  691.    SR.sname = n$ : SR.testn = t$
  692.    status = DoGetStudentTestScore(SR, keyhandle, Recno&)
  693.    DO UNTIL status <> 200   'student as entered not found, call search routine
  694.       status = DoFindStudentTestScore(SR, keyhandle, RecNo&)
  695.    LOOP
  696.    IF status = 0 THEN
  697.       PRINT "Student:" ; SR.sname ; " old score:" ; SR.score
  698.       INPUT "Enter new score:"; s% : RSET SR.score = STR$(val(s%))
  699.       status = DoUpdateTestScore(SR, keyhandle, Recno&)
  700.    ENDIF
  701. Any change to a key field will initiate a key file update automatically.
  702. See: delete_a_record  UpdateXB
  703. ~delete_a_record - How to
  704. To delete a particular record in the database we must first locate it using
  705. one of the get routines such as GetEqualXB. These Get() routines return the
  706. actual record number of the data record accessed by Get() into the AccessPack
  707. RecNo. Having used one of the Get() routines to find the data record, make a
  708. call to the delete function:
  709.    'delete all of Student's records, 1 record for each test he's taken
  710.    INPUT "Student name to delete",n$
  711.    SR.sname = n$
  712.    status = DoGetStudent(SR, keyhandle, RecNo&)
  713.    DO UNTIL status <> 200   'student as entered not found, call search routine
  714.       status = DoFindStudent(SR, keyhandle,RecNo&)
  715.    LOOP
  716.    DO
  717.       status = DoDeleteRecord(SR, RecNo&)  'does not affect key files
  718.       IF status = 0 THEN status = GetNextChkIfSameStudent(SR,keyhandle,RecNo&)
  719.    LOOP UNTIL status <> 0
  720. The DeleteRecordXB routine does not physically remove the record from the data
  721. file but instead tags it as being "deleted".
  722. See: BC_compile_with  DeleteRecordXB
  723. ~BC_compile_with - How to
  724. To create a stand-alone EXE file, compile your BASIC source as required. No
  725. special compiler switches are required. When your compiler is finished and has
  726. reported no errors during the compile, use the LINK program supplied with your
  727. compiler to resolve any external references in your BASIC program code that are
  728. dependant on the BULLET library code.
  729. For example, if you have a single-module BASIC source file called STUGRADE.BAS,
  730. compile it:
  731.  C>bc STUGRADE /o;
  732. If successful, use the LINK program to build the final EXE:
  733.  C>link STUGRADE,STUGRADE.EXE,nul,BULLET.LIB;
  734. If successful, link creates STUGRADE.EXE ready to be run at the DOS prompt.
  735. The BASIC runtime is also supported by BULLET. Just compile as you normally
  736. would (without the /o, of course).
  737. See: LIB_with
  738. ~LIB_with - How to
  739. BULLET.LIB is composed of many separate assembly language modules. All these
  740. modules have been combined into a single, easy-to-use .LIB library. While it
  741. is possible to combine, or add, other .OBJ files or even other .LIB files to
  742. BULLET.LIB, I do NOT, -NOT-, recommend that you do so.
  743. If you need to use two or more libraries with your programs, no problem, LINK
  744. can handle as many as you have. When LINK prompts you for a library file, just
  745. enter BULLET.LIB followed by any other library you need. For example:
  746.  C>LINK
  747.  Microsoft (R) Segmented-Executable Linker  Version 5.10
  748.  Copyright (C) Microsoft Corp 1984-1990.  All rights reserved.
  749.  Object Modules [.OBJ]: STUGRAD1+STUGRAD2+STUB
  750.  Run File [STUGRAD1.EXE]: STUGRADE.EXE
  751.  List File [NUL.MAP]: nul
  752.  Libraries [.LIB]: BULLET MOUSE;
  753. Consult your linker programs documentation for more.
  754. See: make_a_QLB
  755. ~make_a_QLB - How to
  756. If you use the QuickBASIC environment to program in, you need to build a .QLB
  757. so that you can call the BULLET routines. While QuickBASIC can load only a
  758. single QLB ( C>qb /L quicklib.qlb ), you can combine many LIB and OBJ modules
  759. to create the QLB. For example, to make a QLB of the BULLET.LIB, MOUSE.LIB,
  760. and STUB.OBJ modules:
  761.  C>link /QU BULLET.LIB+MOUSE.LIB+STUB, IDE.QLB, nul, BQLB45.LIB;
  762. Note the extension .LIB on the library modules. This is REQUIRED since LINK
  763. assumes .OBJ by default, as in the case of STUB, above. The quick library,
  764. BQLB45.LIB, is required for the Libraries: prompt. The exact name depends on
  765. the compiler version. Consult your compiler documentation for more.
  766. BASIC PDS note: BASIC PDS requires that all BASIC modules included into a QLB
  767. be compiled using the /Fs compiler switch. This instructs the compiler to
  768. generate code compatible with "far strings". Since BULLET is written entirely
  769. in assembly langauge, this is not an issue. However, if you start QBX.EXE with
  770. /L and get an INVALID FORMAT error, one of the modules in the .QLB file most
  771. likely was a BASIC module that was not compiled with the /Fs switch.
  772. See: LINK_with
  773. ~LINK_with - How to
  774. After successfully compiling your BASIC source code module(s), use the LINK
  775. program to build the EXE program file. For this example let's assume that you
  776. have 2 BASIC source code modules just compiled and their .OBJs available, the
  777. BULLET.LIB library, a stub object file called STUB.OBJ, and MOUSE.LIB.
  778. To build the final stand-alone EXE from this group of files, do the following:
  779.  C>link STUGRAD1+STUGRAD2+STUB,STUGRADE.EXE,nul,BULLET+MOUSE;
  780. The 3 object modules, STUGRAD1, STUGRAD2, and STUB, will have their entire code
  781. included in the EXE program, created as STUGRADE.EXE. The 2 library files,
  782. BULLET.LIB and MOUSE.LIB, will have only the code that is actually referenced
  783. by the 3 object modules included into the EXE program.
  784. If successful, link creates STUGRADE.EXE ready to be run at the DOS prompt.
  785. See: calling_BULLET  AtExitXB
  786. ~calling_BULLET - How to?
  787. BULLET is called through a single entry point. The only argument passed to it
  788. is a segmented far pointer to the control pack. The first two entries in this
  789. pack are the function to be performed and the function return status. BULLET
  790. is a FUNCTION call returning an INTEGER status value.
  791. Each function (or routine) uses a prescribed pack format. For example, some
  792. routines need only know the handle of the file, along with the function number
  793. itself. So, to flush a data file, for example, you would do the following:
  794.  DIM HP AS HandlePack           'could also DIM SHARED
  795.  HP.Func = FLUSHDHXB            'FLUSHDHXB is defined as a CONST in BULLET.BI
  796.  HP.Handle = File2FlushHandle   'the handle as returned from the Open() routine
  797.  stat = BULLET(HP)              'do the actual call to BULLET
  798. The value of stat is set to the completion code as returned by the FlushDHXB
  799. routine. It is the same as the value returned in HP.Stat in all but a few
  800. cases: InsertXB, UpdateXB, ReindexXB, and LockXB. These routines return not the
  801. actual error code, but rather a transaction index number of the access that
  802. failed. See those routines for more information.
  803. See: is_BULLET  FlushDHXB
  804. ~Specs_Overall
  805. BULLET is dBASE III/III+/IV .DBF-compatible. This format is compatible with a
  806. large base of software programs including the latest database packages such as
  807. dBASE IV and FoxPro. Spreadsheet packages such as Excel and 1-2-3 can directly
  808. import BULLET DBF data files, too. And because of BULLET's versatility, it can
  809. also create very non-standard data files. This may be a useful feature if data
  810. secrecy is of concern.
  811. BULLET requires MS-DOS 3.30 or above. It uses 19K of code/static data space and
  812. requires at least 40K of workspace. 140K of workspace is ideal.
  813. Overall Specifications:
  814.               DBF           (per file)          INDEX
  815.       
  816.     Max records: 16,777,215                Max nodes: 65,535
  817.   Record length: 2-4000 (8192)              Max keys: 4,063,170
  818.      Max fields: 128 (255)                Key length: 1-64
  819.    Field length: 1-254 (255)          Max key fields: 16
  820. Total open index plus data files can be up to 255. Numbers in () indicate
  821. extended specifications.
  822. See: Specs_DBF
  823. ~Specs_DBF
  824. To remain compatible with other dBASE III .DBF platforms you should restrict
  825. your data files to the following specifications:
  826.  File ID byte: 3  (83hex if .DBF has memo field, not currently supported)
  827.  Max record size: 4000 bytes  Max fields/rec: 128   Max field size: 254 bytes
  828.  Allowable field name characters: A-Z and the _ (upper-case)
  829.  Allowable field types:
  830.   C-character, 1-254 bytes
  831.   D-date, 8 bytes, in the format YYYYMMDD (19920531)
  832.   L-logical, 1 byte, either space, "T" or "Y", "F" or "N"
  833.   M-memo, 10 bytes, used as pointer into .DBT file (currently not supported)
  834.   N-numeric, 1-19 bytes, ASCII format, uses implicit decimal if needed...
  835.     ...decimal places may be 0, or 2 to (field size - 3) but no more than 15
  836. Restrict all data in .DBF fields to ASCII. This means you should convert binary
  837. data to the equivalent ASCII representation, e.g., if you have the binary value
  838. 22154, it must first be converted to the string "22154" before you can store it
  839. to the .DBF data file. So, while your in-program code deals with binary data,
  840. your I/O code must convert it to/from ASCII. This is a dBASE-compatibility
  841. issue only. If you can forgo these requirements you can use binary fields, any-
  842. character field names, record sizes to 8192 bytes, and up to 255 fields.
  843. See: Specs_DBF_a                                                        -MORE-
  844. ~Specs_DBF_a
  845. A dBASE III .DBF is composed of 3 sections: the header, the field descriptors,
  846. and the data area.
  847. The header structure (first 32 bytes of file):
  848.     Name     Type   Offset  Meaning
  849.  FileID      byte        0  data file type id, 03 standard (43,63,83,88h)
  850.  LastYR      byte        1  last update year, binary
  851.  LastMo      byte        2  last update month, binary
  852.  LastDA      byte        3  last update day, binary
  853.  NoRecs      long        4  number of records in file
  854.  HdrLen      word        8  length of header, including field descriptors, +1
  855.  RecLen      word       10  length of data record including delete tag
  856.  internal    byte    12-31  reserved
  857. The last update values are updated to the current date whenever the .DBF file
  858. is flushed or closed. Likewise, the NoRecs value is updated whenever a record
  859. is added to the .DBF. The FileID is specified when you create the file, HdrLen
  860. and RecLen are computed and stored when the file is created, too.
  861. See: Specs_DBF_b                                                        -MORE-
  862. ~Specs_DBF_b
  863. The field descriptor format (follows header, one per field):
  864.     Name     Type   Offset  Meaning
  865.  FieldName   char        0  field name 10 ASCII characters, A-Z or _ (0-filled)
  866.         0T   byte       10  field name zero-termintor (must be 0)
  867.  FieldType   char       11  field type (C D L M N)
  868.  internal    long       12  reserved
  869.  FieldLen    byte       16  length of this field
  870.  FieldDC     byte       17  decimal count
  871.  internal    byte    18-31  reserved
  872.       
  873. The unused bytes in the FieldName must be set to zeroes (CHR$(0)).
  874. Each field is described by a 32-byte descriptor. The first field's descriptor
  875. starts right after the header proper, at offset +32. After the last field
  876. descriptor is data byte ASCII 13. (Note: the orginal dBASE III has a 0 byte
  877. following this ASCII 13.) Immediately following this is the actual record data.
  878. See: Specs_DBF_c                                                        -MORE-
  879. ~Specs_DBF_c
  880. The data record format:
  881. The first record is located at offset HdrLen (from the header). The first byte
  882. of each record is a delete tag. This tag is maintained by the BULLET routines.
  883. A space, ASCII 32, means the record is not deleted; an asterisk, ASCII 42,
  884. means the record has been deleted (marked as deleted, often this is used as a
  885. method to temporarily tag records, for whatever purpose).
  886. Following the tag is the data for each field, not delimited (i.e., the fields
  887. run together without anything separating them). The second record is at offset
  888. HdrLen+reclen. The start offset of any record in the file can be computed as
  889. (recordnumber - 1) * reclen + HdrLen. All data is in ASCII form.
  890. An EOF marker (ASCII 26) is placed at the end of the last record.
  891. See: Specs_Index
  892. ~Specs_Index
  893. BULLET uses a proprietary, modified b-tree index method to manage the index
  894. files. The supported key types are:
  895.     Type     Length  Meaning
  896.  Character     1-64  ASCII, NLS, or user-supplied sort table
  897.  Integer          2  signed or unsigned 16-bit value
  898.  Long Int         4  signed or unsigned 32-bit value
  899. In addition to the above types, BULLET allows for unique or duplicate keys in
  900. the index file. If duplicates are allowed, BULLET enumerates each key with an
  901. enumerator word (see FirstKeyXB).
  902. The key may be composed of up to 16 character fields or substrings within those
  903. fields. Integer or Long Int keys can be composed of a single field only. The
  904. key expression is specified in text (e.g., "LNAME+SUBSTR(FNAME,1,1)+MI") and is
  905. fully evaluated when the index file is created (for maximum efficiency).
  906. A BULLET index file is composed of 3 sections: the header, the collate-sequence
  907. table, and the node/key entry area.
  908. See: Specs_Index_a                                                      -MORE-
  909. ~Specs_Index_a
  910. The header structure:
  911.     Name     Type   Offset  Meaning
  912.  FileID      byte        0  index file type id, 20
  913.  RootNode    word        1  root node number
  914.  Keys        24bit       3  number of keys in index file
  915.  AvalNode    word        6  node number available for reuse
  916.  FreeNode    word        8  next free node number
  917.  KeyLen      byte       10  key length
  918.  NodeKeys    byte       11  number of keys that fit on a node
  919.  CodePage    word       12  code page ID
  920.  CtryCode    word       14  country code
  921.  internal    byte    16-21  reserved
  922.  KeyFlags    word       22  key flags
  923.  KeyExprn    byte   24-159  key expression
  924.  internal    byte      160  reserved
  925.  KeyXFlds    byte      161  number of fields used by key (1-16)
  926.  KeyXlate    byte  162-225  translated key expression
  927.  internal    byte  226-253  reserved
  928.  CTsize      word      254  collate-sequence table size
  929. See: Specs_Index_b                                                      -MORE-
  930. ~Specs_Index_b
  931. The collate-sequence table structure:
  932.  table      byte   256-511  sort weight table of ASCII character 0-255
  933. Node/key entry structure (first entry is in node #1, file offset 512):
  934.   2A  0A 00  KEY123  7B 00 00  12 00  KEY178  B2 00 00  0C 00 ...
  935.    1.   2.     3.       4.       5.     6.       7.       8.   9.
  936.       
  937.  1. Key count for that node (first byte of each node)
  938.  2. 16-bit node back pointer (for non-leaf nodes, 0 if leaf node)
  939.  3. First key value, "KEY123" in this case
  940.  4. 24-bit data record pointer (low word/hi byte) 7Bh = DBF record number 123
  941.  5. 16-bit node forward ptr/back ptr (for non-leaf nodes, 0 if leaf node)
  942.     --in this case, it indicates that the key following KEY123 is in node# 12h
  943.     --and also that the key before KEY178 is in that node as well
  944.  6. Second key (here "KEY178")
  945.  7. 24-bit data pointer (record number in DBF)
  946.  8. 16-bit forward node pointer (for non-leaf nodes, 0 if leaf node)
  947.  9. Repeat 6 to 8 for each key on node. (node size is 512 bytes)
  948. See: Specs_Index_c                                                      -MORE-
  949. ~Specs_Index_c
  950. As in many b-tree implementations, BULLET's index files maintain an average
  951. load percentage of approximately 66%. This means that in any given node, 66% of
  952. the available space is in use. The free space in the node is attributable to
  953. the constant reshaping of the file as keys are inserted or deleted, causing the
  954. nodes to be split and merged. A split will occur when an insert needs to add a
  955. key to an already full node; a merge will occur when a neighboring node is
  956. small enough to be merged into a just split node. This constant prune-and-graft
  957. of the b-tree results in a node load of about 66% (50% in degenerate cases such
  958. as with already sorted data). It's this aspect of the b-tree that makes it a
  959. consistent performer and a widely-used method of managing index files.
  960. The following formula can be used to determine the number of keys that an index
  961. file can hold:
  962.   MaxKeys = MaxNodes * MaxKeysPerNode * LoadFactor
  963.   MaxKeys = 65535 * 509/(keylen+5) * .66
  964. The load factor can be increased to ~95% by using the ReindexXB routine. This
  965. load factor results in superior retrieval speeds since there are more keys on
  966. each node. Insertion speed will be decreased, however, since splitting will
  967. occur more frequently, though perhaps not noticeably.
  968. See: Specs_Memory
  969. ~Specs_Memory
  970. BULLET allocates memory on an as-needed basis. When linked to an executable
  971. program, BULLET makes use of 17.5K of code space and about 1.5K of static
  972. DGROUP data space. To accomodate the wide variety of compilers, BULLET's API
  973. structure will have the linker included all of the library into your final EXE
  974. program.
  975. All runtime memory allocations are obtained from the operating system. This
  976. means that if your compiler generates code to allocate all the free memory at
  977. startup for its far heap, you need to instruct it to free up some memory for
  978. BULLET's use. In QuickBASIC you can use SETMEM(). You can also use the linker
  979. /CP:n option to limit the amount that the compiler-generated startup code
  980. allocates. The EXEHDR.EXE program can also be used to modify this amount. The
  981. linker /CP: option and the EXEHDR program both modify the EXE header. To
  982. determine if you need to release memory use the MemoryXB routine. It reports
  983. the operating system memory available for use by BULLET.
  984. The amount of memory that BULLET requires is based on which routines are used.
  985. See the next screen for a list of the routines that make malloc calls to the
  986. operating system and how much memory they require.
  987. (Most compilers do not allocate all memory as does QuickBASIC.)
  988. See: Specs_Memory_a  MemoryXB                                           -MORE-
  989. ~Specs_Memory_a
  990. Routines making dynamic memory allocations and amount (within 
  991.  16 bytes):
  992.   Routine           Bytes        Basis
  993. InitXB                  272   permanent, released when program ends (JFTmode=1)
  994. BackupFileXB             32K  temp, released when routine exits
  995. CreateDXB        48+(NF*32)   temp, released when routine exits (NF=NoFields)
  996. CreateKXB               544   temp, released when routine exits
  997. OpenDXB     144+((1+NF)*32)   semi-permanent, released when file closed
  998. OpenKXB                1264   semi-permanent, released when file closed
  999. PackRecordsXB      RL to 64K  temp, released when routine exits (RL=RecLength)
  1000. ReindexXB        32K to 128K  temp, released when routine exits
  1001. UpdateXB              2K+RL   temp, released when routine exits (RL=RecLength)
  1002. For example, when BackupFileXB is called it attempts to allocate 32K from the
  1003. OS. If 32K is not available, BackupFileXB returns with an error code of 8 (DOS
  1004. error #8, not enough memory). And, for example, ReindexXB attempts to allocate
  1005. 128K if available. If not, it continues in decrements of 32K, down to 32K.
  1006. Needed stack space is 4K (max) for ReindexXB. Other routines can operate with
  1007. less than 1K of stack space. In other words, stack use is minimal.
  1008. See: Specs_OS_calls
  1009. ~Specs_OS_calls
  1010. BULLET makes use of the following operating system calls:
  1011. INT21/25 DOS_setvector                  INT21/44/0B DOS_setsharingretrycount
  1012. INT21/2A DOS_getdate                    INT21/48 DOS_malloc
  1013. INT21/30 DOS_version                    INT21/49 DOS_free
  1014. INT21/35 DOS_getvector                  INT21/51 DOS_getpsp
  1015. INT21/39 DOS_makedir                    INT21/56 DOS_renamefile
  1016. INT21/3D DOS_openfile                   INT21/59 DOS_getextendederror
  1017. INT21/3E DOS_closefile                  INT21/5A DOS_createtempfile
  1018. INT21/3F DOS_readfile                   INT21/5B DOS_createnewfile
  1019. INT21/40 DOS_writefile                  INT21/5C DOS_lockunlockfile
  1020. INT21/41 DOS_deletefile                 INT21/65/01 DOS_getextendedcountryinfo
  1021. INT21/42 DOS_movefileptr                INT21/65/06 DOS_getcollatesequencetable
  1022. INT21/44/09 DOS_isdriveremote           INT21/67 DOS_sethandlecount
  1023. INT21/44/0A DOS_isfileremote            INT2F/10/00 DOS_isshareinstalled
  1024. No other operating system calls are made. No BIOS calls are made.
  1025. See: Specs_Languages
  1026. ~Specs_Languages
  1027. BULLET is compatible with most DOS compilers. The only requirements are that
  1028. your compiler allow you to:
  1029.  1. Call a library routine via a FAR call using PASCAL calling convention
  1030.  2. Pass a far pointer (of the parameter pack) on the stack, by value
  1031.  3. Supply far pointers to the various pack parameters
  1032.  4. Be able to return an integer value from the FAR call
  1033.     (this is optional but recommended for the transaction-based routines)
  1034. These requirements can be met with most BASIC, C, and other-language DOS
  1035. compilers.
  1036. CZ online help is currently available in BASIC and C versions. Others are
  1037. pending. You should be able to do well with either of these versions using
  1038. other-language compilers since the only difference is the source code examples.
  1039. See: Specs_OSes
  1040. ~Specs_OSes
  1041. BULLET is currently available only for MS-DOS and compatible operating systems.
  1042. It requires DOS 3.3 or higher.
  1043. To provide efficient memory use, BULLET uses a single-buffer cache per index
  1044. file. The single-buffer cache also provides for very quick network access since
  1045. a minimum amount of memory needs to be flushed when releasing control of BULLET
  1046. files. For maximum speed, however, an external high-performance disk cache can
  1047. be used. Hyperdisk is a good choice (shareware, $50+). A properly configured
  1048. cache can increase BULLET's performance from 10 to 300%. The most improvement
  1049. is with the InsertXB routine. The least is with ReindexXB and PackRecordsXB,
  1050. which do most of their work in temporarily allocated memory. Hyperdisk is about
  1051. the best designed disk cache available for PCs.
  1052. If you do not use a disk cache then it's recommended that you set your BUFFERS=
  1053. statement in CONFIG.SYS to at least 20 or 30. Even without a disk cache, BULLET
  1054. is still very fast. Also, be sure to set your FILES= to the number of files
  1055. that you'll be opening at any one time. If you set FILES=20 you can have BULLET
  1056. open 14 files (CZ.COM uses 1 and DOS reserves 5 more). You can set FILES=255
  1057. allowing BULLET to open up to 249 files at one time.
  1058.                  DO NOT set FILES= to a value greater than 255.
  1059. See: Specs_Networks
  1060. ~Specs_Networks
  1061. BULLET currently operates on all DOS-compatible network platforms.
  1062. Be sure to install SHARE.EXE on the local machine. If you'll be opening many
  1063. files you should extended the default SHARE file-sharing information space and
  1064. the number of locks that can performed at one time. The DOS 5.0 default is
  1065. /F:2048 and /L:20. This allocates 2K for file-sharing info space and allows 20
  1066. consecutive locks to be active. If the F: value is too low, error 5 (extended
  1067. error 32) is returned on an open attempt. If you extend the JFT in InitXB and
  1068. plan to use many files, say more than 50, be sure to extend /F: by 2K for every
  1069. 50 additional files and set the /L: to the number of files you plan on having
  1070. open. If L: is too low, error 1 (ext err 36) is returned on a lock attempt.
  1071. As an example, if you'll be using 100 files, set FILES=106 in CONFIG.SYS, set
  1072. SHARE /F:4096 /L:106, and IP.JFTmode=1 for InitXB. These values are a minimum.
  1073. If you have more than one process active, you need to account for other
  1074. applications' needs also.
  1075. Note that Windows always returns a "SHARE is installed" using the DOS detection
  1076. routines used by BULLET. To determine if SHARE is actually installed, attempt
  1077. to perform a lock using one of the LockXB routines. An error code indicates
  1078. that SHARE is not installed.
  1079. See: Specs_Performance
  1080. ~Specs_Performance
  1081.  Test: Reindex 1,000 to 1,000,000 records (BB_LAI10.BAS)
  1082.        DBF: extended DBF using binary sort field
  1083.        key: LONG+SIGNED+UNIQUE                        Machine: 486/33 SHO
  1084.  1Meg
  1085.                                                      *
  1086.      
  1087.      
  1088.                                     *
  1089.      
  1090.                    Records  Time  Reindex Rate
  1091.      
  1092.        *           -------  ----  ------------
  1093.  100k
  1094.   *                   1000   < 1  1000+/sec
  1095.      
  1096.                       5000     2    2500
  1097.      
  1098.  *                   10000     4    2500
  1099.      
  1100. *                    25000     7    3571   3500+ records indexed/second!
  1101.      
  1102.                      50000    14    3571   Times in table are in seconds
  1103.   10k
  1104. *                   100000    28    3571
  1105.      
  1106.                     200000    81    2469
  1107.      
  1108. *                   500000   355    1408
  1109.      
  1110.                    1000000  1124     890
  1111.    1k
  1112.      
  1113.  time (secs)  100       200       300       400       18:00     20:00 (min)
  1114. See: Specs_Perf_a                                                       -MORE-
  1115. ~Specs_Perf_a
  1116.  Test: Add 1,000 to 1,000,000 records (BB_LAI10.BAS)
  1117.        DBF: extended DBF using binary sort field
  1118.        key: not indexed                               Machine: 486/33 SHO
  1119.  1Meg
  1120.                                                       *
  1121.      
  1122.      
  1123.                          *
  1124.      
  1125.          *         Records  Time    Add Rate
  1126.      
  1127.                    -------  ----  ------------
  1128.  100k
  1129.     *                 1000   < 1  1000+/sec
  1130.      
  1131.                       5000     2    2500
  1132.      
  1133.   *                  10000     4    2500
  1134.      
  1135. *                    25000    12    2083   2000+ records added/second!
  1136.      
  1137.                      50000    24    2083   Times in table are in seconds
  1138.   10k
  1139. *                   100000    50    2000
  1140.      
  1141.                     200000   103    1942
  1142.      
  1143. *                   500000   262    1908
  1144.      
  1145.                    1000000   529    1890
  1146.    1k
  1147.      
  1148.  time (secs)  100       200       300       400        8:00     10:00 (min)
  1149. See: Specs_Perf_b                                                       -MORE-
  1150. ~Specs_Perf_b
  1151.  Test: Access 1,000 to 1,000,000 keys(*), keys+records(+) (BB_LGK10.BAS)
  1152.        DBF: extended DBF using binary sort field
  1153.        key: LONG+SIGNED+UNIQUE                        Machine: 486/33 SHO
  1154.  1Meg
  1155.                                          *            +
  1156.      
  1157.      
  1158.               *                          +
  1159.      
  1160.     *        +  Keys   Time  Access Rate   Keys+Recs Time  Access Rate
  1161.      
  1162.               -------  ----  -----------   --------- ----  ------------
  1163.  100k
  1164.  *   +           1000   < 1  1000+/sec         1000   < 1  1000+/sec
  1165.      
  1166.                 10000     1    10000          10000     6    1667
  1167.      
  1168.                100000    22     4545         100000    68    1471
  1169.      
  1170.                200000    49     4082         200000   144    1389
  1171.      
  1172.                500000   147     3401         500000   427    1171
  1173.   10k
  1174. *+            1000000   424     2358        1000000   948    1055
  1175.      
  1176.      
  1177.              Times for forward/reverse (Next/Prev) were similar (
  1178.      
  1179. +            Times in table are in seconds
  1180.    1k
  1181.      
  1182.  time (secs)  100       200       300       400       15:00     17:00 (min)
  1183. See: Specs_Perf_c                                                       -MORE-
  1184. ~Specs_Perf_c
  1185.  Test: Insert 1,000 random records to existing data/key files (BB_LAA10.BAS)
  1186.        DBF: extended DBF using binary sort field
  1187.        key: LONG+SIGNED+UNIQUE                        Machine: 486/33 SHO
  1188.  Base records/keys   Inserted   Time / Rate
  1189.  -----------------   --------   ----   ----
  1190.               1000       1000     15     67 records+keys inserted/second
  1191.              10000       1000     18     56 Times in table are in seconds
  1192.             100000       1000     19     53
  1193.             200000       1000     20     50
  1194.  This tests the InsertXB speed. A data file containing the base records and
  1195.  an index file containing the same number of keys has inserted into it 1000
  1196.  random keys and records. The records are added to the end of the data file
  1197.  and the keys are inserted into their appropriate place in the index file.
  1198.  Typically InsertXBs would be done online. The rate of 50 inserts/second at
  1199.  200,000 records would indicate a time of 0.02 seconds per insert on even a
  1200.  very large database (0.015 secs/insert @ 1000 records).
  1201. See: Specs_Perf_d                                                       -MORE-
  1202. ~Specs_Perf_d
  1203.  Test: Update 1,000 records by changing the key field (BB_LAU10.BAS)
  1204.        DBF: extended DBF using binary sort field
  1205.        key: LONG+SIGNED+UNIQUE                        Machine: 486/33 SHO
  1206.  Base records/keys    Updated   Time / Rate
  1207.  -----------------    -------   ----   ----
  1208.               1000       1000     50     20 records+keys updated/second
  1209.              10000       1000     59     17 Times in table are in seconds
  1210.             100000       1000    108      9
  1211.             200000       1000    126      8
  1212.  This tests the UpdateXB speed. A data file containing the base records and
  1213.  an index file containing the same number of keys has the first 1000 keys and
  1214.  records changed. This forces the old data record to be replaced, the old index
  1215.  key to be deleted, and a new key for the record to be inserted in the index
  1216.  file.
  1217.  Typically UpdateXBs would be done online. The rate of 8 updates/second at
  1218.  200,000 records would indicate a time of 0.125 seconds per update on even a
  1219.  very large database (0.05 secs/update @ 1000 records).
  1220. See: Specs_Overall
  1221. ~InitXB
  1222. Pack: InitPack          Src: InitXBsrc          Func:   0/System
  1223. Before using any routine you must initialize the BULLET file system.
  1224. If you want more than the standard number of file handles, set InitPack.JFTmode
  1225. to 1. This expands the current process's Job File Table to allow 255 open files
  1226. maximum.
  1227. On return the DOS version (INT21/30h) is in InitPack.DOSver. Major version in
  1228. the high byte. Minor in the low. The BULLET version (*100) is returned as is
  1229. the address of the ExitXB routine. You can use this address to register ExitXB
  1230. with your own _atexit function if your runtime library does not provide _atexit
  1231. already.
  1232. Note: _atexit is a routine available in most DOS, OS/2, and ANSI runtime
  1233. library code and is called just prior to the program ending. See AtExitXB for
  1234. information on what to do if your library does not have _atexit.
  1235. See: ExitXB
  1236. ~ExitXB
  1237. Pack: ExitPack          Src: ExitXBsrc          Func:   1/System
  1238. Before ending your program you should call ExitXB to close any open BULLET
  1239. files. This also will release any memory still allocated to those files.
  1240. This restores the default keyboard break handlers if they were changed.
  1241. In normal operation you would see to closing all files yourself. However, if
  1242. your program fails to reach the programmed end, it's very possible that files
  1243. may still be left open. It is essential that you properly close all BULLET
  1244. files before ending. There are two methods to achieve this:
  1245. 1. In BASIC use ON ERROR GOTO label, where label is in the main module. The
  1246. code at label would then call ExitXB.
  1247. 2. Use AtExitXB to automatically register ExitXB to be executed in the normal
  1248. shut-down code of the compiler. This method is preferred.
  1249. In the QB environment you can easily stop and restart the executing program
  1250. without having reached the end of the program where you call ExitXB. Previously
  1251. opened BULLET files remain open and memory used remains allocated. Eventually
  1252. you will run out of files or out of memory. Use AtExitXB to prevent this.
  1253. See: AtExitXB
  1254. ~AtExitXB
  1255. Pack: ExitPack          Src: AtExitXBsrc        Func:   2/System
  1256. Used to automatically close all BULLET files, release allocated memory, and
  1257. restore the default Break handlers when your program ends. Your compiler
  1258. generates specific code to be executed in the course of ending your program.
  1259. AtExitXB registers the ExitXB routine to be performed in this compiler-
  1260. generated code.
  1261. This routine is standard in most DOS, OS/2, and ANSI runtime libraries. If   
  1262. yours does not have _atexit, then you must link with the supplied            
  1263. NOATEXIT.OBJ file:                                                           
  1264.                                                                              
  1265. C>link YOURPRG + NOATEXIT, ...                                               
  1266. You can tell if your compiler doesn't supply _atexit at link time. LINK reports
  1267. '_atexit' : unresolved external. Add NOATEXIT.OBJ as described above.
  1268. Be sure that your _atexit routine is for the medium, large, or huge memory
  1269. models since BULLET uses multiple code segments and far calls.
  1270. See: MemoryXB  ExitXB  BreakXB
  1271. ~MemoryXB
  1272. Pack: MemoryPack        Src: MemoryXBsrc        Func:   3/System
  1273. This is the only BULLET routine that can be used before InitXB. It reports the
  1274. largest free block of memory available from the OS. This memory does not
  1275. include fragmented memory or UMB memory that BULLET can and will use.
  1276. Some compilers provide their own memory management and thus will use most or 
  1277. all of the contiguous memory when its program loads. BULLET, however,        
  1278. allocates memory on an as-needed basis, directly from the OS, and releases it
  1279. back to the OS as soon as it is no longer needed. If the memory amount       
  1280. returned by MemoryXB is low, your compiler's startup code has pre-allocated  
  1281. all OS memory. If the memory available from the OS is less than your         
  1282. application needs, you need to instruct your program to release some of the  
  1283. memory back to the OS so BULLET can use it. For QuickBASIC and BASIC PDS, see
  1284. the BASIC function SETMEM().                                                 
  1285. With DOS able to use UMB memory, memory for BULLET requests may be provided
  1286. from this region. You can use StatPack.HereSeg from StatXB to locate from which
  1287. segment address the allocations are being made. Anything above C800h is UMB.
  1288. See: BreakXB  StatXB  OpenDXB  OpenKXB
  1289. ~BreakXB
  1290. Pack: BreakPack         Src: BreakXBsrc         Func:   4/System
  1291. Disables system response to Control-C and Control-Break keys preventing users
  1292. from inadvertently exiting the program without first doing a BULLET shutdown.
  1293. It's REQUIRED that you reinstate the default break handlers with this routine
  1294. before ending your program. ExitXB automatically reinstates the default break
  1295. handlers.                                                                    
  1296. This routine will not disable Control-Alt-Delete (a warm-boot). If the user is
  1297. at this point, he may prefer to exit via a warm-boot rather than reset the
  1298. machine.
  1299. Also, this routine does not prevent QuickBASIC and BASIC PDS from terminating
  1300. a program at an INPUT statement. This is because these versions of BASIC reset
  1301. the INT1B and INT23 vectors each time the INPUT is used. If AtExitXB has been
  1302. issued, all BULLET files will be properly closed even if *User Break* occurs.
  1303. This routine will not surpress the ^C displayed by DOS. If you don't want the
  1304. ^C to be displayed move the cursor to a location off-screen, say, row 26.
  1305. See: BackupFileXB  ExitXB
  1306. ~BackupFileXB
  1307. Pack: CopyPack          Src: BackupFileXBsrc    Func:   5/System
  1308. Copy an open BULLET key or data file. BULLET repacks and reindexes files in-
  1309. place, requiring less disk space to perform the function. BackupFileXB allows
  1310. you to safely copy a file before doing this.
  1311. This function is recommended prior to packing a data file with PackRecordsXB 
  1312. since the data is very valuable. There is probably little need to do so when 
  1313. reindexing an index file since index files can be constructed very easily    
  1314. from the data file.                                                          
  1315. See: StatHandleXB  PackRecordsXB  ReindexXB
  1316. ~StatHandleXB
  1317. Pack: StatHandlePack    Src: StatHandleXBsrc    Func:   6/System
  1318. Get information on a DOS file handle number to determine if it is a BULLET file
  1319. and if so, if that file is a BULLET key or data file.
  1320. If the returned ID value is 0, the handle is to a BULLET index file. ID=1 then
  1321. the handle is a BULLET .DBF file. ID= -1 then the handle is not a BULLET file.
  1322. See: CreateDXB  StatDXB  StatKXB
  1323. ~GetExtErrorXB
  1324. Pack: XErrorPack        Src: GetExtErrorXBsrc   Func:   7/System
  1325. Get the extended error information for the last operation. This information
  1326. includes the extended error code, the error class, the recommended action, and
  1327. the location of the error. See Errors_DOS for the extended error meaning an
  1328. Errors_DOS_c for the class, action, and locus code meanings.
  1329. Note that on fatal DOS errors, such as an open floppy drive door, the extended
  1330. error code returned is 83 - fail on INT24. This indicates that the INT24
  1331. handler was invoked by DOS and that the INT24 handler told DOS to ignore the
  1332. error. (BULLET invokes its own INT24 handler each time it accesses the DOS file
  1333. system and restores it promptly after the access.) In such cases, this extended
  1334. error code is less informative than the standard return code and, the other
  1335. 'extended' information should be disregarded. (In fatal DOS errors the standard
  1336. return code IS the extended error code.)
  1337. This routine returns the extended error information for the LAST DOS system  
  1338. error. This information remains the same until the next DOS system error.    
  1339. See: CreateDXB  Errors_DOS
  1340. ~DVmonCXB
  1341. Pack: DVmonPack         Src: DVmonCXBsrc        Func:   9/DEBUG
  1342. Control BULLET debug monitor.
  1343. This routine is available only in the debug engine.                          
  1344. The monitor displays in realtime the state of a data file handle, or an index
  1345. and data file handle pair if an index handle is specified. DVmonCXB is best
  1346. used on dual-display systems in which the video output is sent to the secondary
  1347. video monitor. In any case, a 4000-byte screen image is updated in real-time.
  1348. To use the monitor, set mode=1, handle=file to monitor, and VideoSeg=segment
  1349. address of 4000-byte area. The typical VideoSeg would be to video memory. If
  1350. you have a color system as the main monitor and a mono as the secondary, set
  1351. VideoSeg=&HB000. Detail system stats are continually updated to the secondary
  1352. monitor. If you have a single monitor with at least 2 video pages, set VideoSeg
  1353. to your base address plus the page size\16, typically &HB800+(4096\16). If you
  1354. have only a single-page video system, you can allocate a 4000-byte memory area
  1355. and update the video manually by moving it to your video display (80x25).
  1356. See: CreateDXB  StatDXB  StatKXB
  1357. ~CreateDXB
  1358. Pack: CreateDataPack    Src: CreateDXBsrc       Func:  10/Mid-level
  1359. Create a new BULLET .DBF data file. Before using this routine allocate a field
  1360. description array of TYPE FieldDescTYPE for at least as many fields as are in
  1361. the record.
  1362. Conventional dBASE .DBF files have a FileID=3. Other possible FileIDs that you
  1363. may come across are (in hex):
  1364.  43h \__ are special-use Xbase IV DBF files, BULLET can process these file IDs
  1365.  63h /                                    since they are similar to ID type 3
  1366.  83h --- this DBF file has an Xbase III/III+ memo field/file
  1367.  88h --- this DBF file has an Xbase IV memo field/file
  1368. In creating your .DBF files, specify FileID=3 to ensure compatibility across 
  1369. Xbase versions.                                                              
  1370. BULLET makes no special use of the FileID byte.
  1371. See: OpenDXB  FieldDescTYPE  CreateKXB
  1372. ~OpenDXB
  1373. Pack: OpenPack          Src: OpenDXBsrc         Func:  11/Mid-level
  1374. Open an existing .DBF data file for use. You need to specify two things, the
  1375. filename and the DOS file access mode. If the open succeeds, the DOS file
  1376. handle is returned. Use this handle for all further access to this file.
  1377. Each .DBF data file you open allocates 144+((1 + number of fields) * 32) bytes
  1378. for internal use. This memory is not deallocated until you close the file with
  1379. CloseDXB or execute ExitXB.
  1380. You must open the data file before you can open (or create) any of its index
  1381. files.
  1382. See: CloseDXB  OpenKXB
  1383. ~CloseDXB
  1384. Pack: HandlePack        Src: CloseDXBsrc        Func:  12/Mid-level
  1385. Close an existing .DBF data file for use. Closing the file updates the file
  1386. header and deallocates the memory used by this file.
  1387. You MUST close all BULLET files before ending your program or file corruption
  1388. may occur. To ensure that all files are closed in the event of an unscheduled
  1389. program termination, use AtExitXB.                                           
  1390. See: StatDXB  ExitXB  CloseKXB
  1391. ~StatDXB
  1392. Pack: StatDataPack      Src: StatDXBsrc         Func:  13/Mid-level
  1393. Get basic information on the BULLET .DBF data file handle specified.
  1394. Information returned includes the number of records in the file, the record
  1395. length, number of fields per record, and the date the file was last updated.
  1396. Typically, your program will keep track of whether a particular handle belongs
  1397. to a data file or a key file. In cases where this is not possible, call the
  1398. StatHandleXB routine to determine what file type a handle is.
  1399. Note that a just-created data file will have the LastUpdate date set to 0/0/0.
  1400. See: ReadDHXB  StatKXB  StatHandleXB
  1401. ~ReadDHXB
  1402. Pack: HandlePack        Src: ReadDHXBsrc        Func:  14/Mid-level
  1403. Reload the disk copy of the data header for the opened .DBF data file handle
  1404. to the internal copy.
  1405. In single-user, single-tasking systems this routine is not needed. However, in
  1406. a multi-user or multi-tasking system it's possible, and desirable, for two or
  1407. more programs to use the same data file. Consider this scenario: A data file
  1408. has 100 records. Two programs access this data file, both opening it. Program 1
  1409. locks the file, adds a new record, then flushes and unlocks the file. Program 1
  1410. knows that there are now 101 records in the file. However, Program 2 is not
  1411. aware of the changes that Program 1 made--it thinks that there are still 100
  1412. records in the file. This out-of-sync situation is easily remedied by having
  1413. Program 2 reload the data header from the file on disk.
  1414. How does Program 2 know that it needs to reload the header? It doesn't. Instead
  1415. BULLET uses a simple yet effective approach when dealing with such problems.
  1416. Whenever your program locks a file, BULLET automatically reloads the header.
  1417. Whenever you unlock a file, BULLET automatically flushes the header.
  1418. See: FlushDHXB  ReadKHXB  LockXB
  1419. ~FlushDHXB
  1420. Pack: HandlePack        Src: FlushDHXBsrc       Func:  15/Mid-level
  1421. Write the internal copy of the data header for the opened .DBF data file handle
  1422. to disk. The actual write occurs only if the header has been changed.
  1423. This is to ensure that the data header on disk matches exactly the data header
  1424. that is being maintained by BULLET. Also, this routine updates the operating
  1425. system's directory entry for this file.
  1426. Assume the following: A data file with 100 records. Your program opens the data
  1427. file and adds 1 record. Physically, there are 101 records on disk. However, the
  1428. header image of the data file on disk still reads 100 records. This isn't a
  1429. problem, BULLET uses its internal copy of the data header and the internal copy
  1430. does read 101 records. BUT, if there were a system failure now, the disk image
  1431. would not get updated. After the system restart, BULLET opens the file, reads
  1432. the header and thinks that there are 100 records. You lost a record. Now, if
  1433. after that add above, your program issued a FlushDHXB, the header on disk is
  1434. refreshed with the internal copy, keeping the two in-sync. Also, the routine
  1435. updates the DOS directory entry, keeping things neat there as well. Still, it
  1436. doesn't come without cost: flushing will take additional time, therefore, you
  1437. may elect to flush periodically, or whenever the system is idle.
  1438. See: CopyDHXB  ReadDHXB  FlushKHXB  LockXB
  1439. ~CopyDHXB
  1440. Pack: CopyPack          Src: CopyDHXBsrc        Func:  16/Mid-level
  1441. Copy the .DBF file structure of an open data file to another DOS file.
  1442. This routine makes it easy for you to duplicate the structure of an existing
  1443. .DBF file without having to specify all the information needed by CreateDXB.
  1444. The resultant .DBF will be exactly like the source, including number of fields
  1445. and field descriptions. It will contain 0 records.
  1446.      
  1447. See: ZapDHXB  CopyKHXB
  1448. ~ZapDHXB
  1449. Pack: HandlePack        Src: ZapDHXBsrc         Func:  17/Mid-level
  1450. Delete all records for a .DBF data file.
  1451. This routine is similar to CopyDHXB except for one major difference: ALL DATA
  1452. RECORDS IN THE *SOURCE* FILE ARE PHYSICALLY DELETED, so be *careful*.
  1453. If you have a .DBF file with 100 records and use ZapDHXB on it, all 100 records
  1454. will be physically deleted and the file truncated to 0 records. There is no
  1455. return from this routine. All data is gone.
  1456.                            
  1457.                            
  1458. * C A U T I O N *
  1459.                            
  1460.      
  1461. See: CreateKXB  CopyDHXB  ZapKHXB
  1462. ~CreateKXB
  1463. Pack: CreateKeyPack     Src: CreateKXBsrc       Func:  20/Mid-level
  1464. Create a new BULLET key file. Before you can create a key file, you must first
  1465. have opened (and have created if necessary) the BULLET .DBF data file that it
  1466. is to index. (BULLET couples index and data files tightly.)
  1467. To create the key file, you need to provide the key expression, key flags, .DBF
  1468. file link handle, and optionally, the code page ID, country code, and collate
  1469. table.
  1470.                                 Key Expression
  1471. The key expression is an ASCII character string composed of the elements that
  1472. are to make up this index file's key. The key can be composed of any or all of
  1473. the fields in the .DBF data record or sub-strings within any of those fields.
  1474. Two functions are supported in evaluating a key expression. These are SUBSTR()
  1475. and UPPER(). SUBSTR() is similar to BASIC's MID$() in that it extracts part of
  1476. a string starting at a particular position for x number of characters. UPPER()
  1477. is similar to UCASE$() in that it converts all lower-case letters to their
  1478. upper-case equivalent. Since BULLET supports NLS, UPPER() conversion is not
  1479. required for proper sorting of mixed-case text strings.
  1480. See: CreateKXB_a  CreateDXB                                             -MORE-
  1481. ~CreateKXB_a
  1482. All names used in the key expression must be a valid field name in the DBF data
  1483. file. Some sample key expressions given that the .DBF has the following fields:
  1484.  Fields...             Valid key expressions
  1485.      
  1486.  FNAME C 25 0       kx = "LNAME"
  1487.  LNAME C 25 0       kx = "LNAME+FNAME"
  1488.  SSN   C  9 0       kx = "SUBSTR(LNAME,1,4)+SUBSTR(FNAME,1,1)+SUBSTR(SSN,6,4)
  1489.  DEPT  N  5 0       kx = "UPPER(LNAME+FNAME)"  (for non-NLS index files)
  1490.   :     :           kx = "DEPT"
  1491.                                     Key Flags
  1492. The key expression is used in conjunction with the key flags to determine the
  1493. type of key generated.
  1494. First, if your index file is to disallow duplicate keys, add 1 to KeyFlag.
  1495. If you have a key composed of a character field(s) or portions thereof, you
  1496. specify a KeyFlag = 2. This instructs BULLET that the sort order is left-to-
  1497. right (proper mixed-case sorting is available, see code page ID).
  1498. See: CreateKXB_b                                                        -MORE-
  1499. ~CreateKXB_b
  1500. If you have a key composed of a numeric field(s) or portions thereof, you can
  1501. also specify a KeyFlag = 2. This instructs BULLET to treat the numeric field
  1502. as a regular character field for sorting. To ensure proper sorting, you must
  1503. decimal-align the +numeric strings in the .DBF data field, i.e., right-justify
  1504. the numeric strings (dBASE .DBF numeric strings are stored as ASCII strings).
  1505. In addition, if you have a key composed of a SINGLE numeric field (fld type N)
  1506. and the field is an integer (NO DECIMAL POINT), you can specify a KeyFlag of 16
  1507. or 32. KeyFlag=16 is for a field known to be in the range 0-65535 (or -32768 to
  1508. 32767 if the key is a signed value, see below) and KeyFlag=32 if the field is
  1509. known to be in the range 0-4,294,967,295 (-2147483648 to 2147483647 if signed).
  1510. These KeyFlag values instruct BULLET to sort the key as a 16/32-bit BINARY
  1511. value. It also stores the key as a 16- or 32-bit value (only 2 or 4 bytes) in
  1512. the index, eventhough the data field is in ASCII (keyflag=16 or 32).
  1513. Although not dBASE compatible, you may use BINARY FIELDS in your data records.
  1514. dBASE always has ASCII data in the data fields, even if the field is numeric.
  1515. For example, an N type field of 8.2 is stored as an ASCII text string in the
  1516. data record, say, a string like " 1100.55". If you want dBASE compatibility
  1517. your field data must also be ASCII. However, if you can forgo this requirement,
  1518. you can use binary values in the fields.
  1519. See: CreateKXB_c                                                        -MORE-
  1520. ~CreateKXB_c
  1521. To do this you must specify a field type of "B" (actually, anything but a "N")
  1522. and, SINCE IT'S TO BE USED AS A KEY FIELD, ALSO SET THE 16- or 32-bit KeyFlag.
  1523. Unique and signed may also be flagged. The field length for a "B" field type is
  1524. 2 or 4. Make sure the key flags match (2 if cINTEGER, 4 if cLONG).
  1525. If you specify a binary key flag (for either N or B field types), you must also
  1526. specify whether the field is to be treated as a signed or unsigned value. If
  1527. values less than 0 are possible, add to KeyFlag the hex number &H8000.
  1528.  KeyFlag = cUNIQUE + cCHAR              'unique character key (NLS sort)
  1529.  KeyFlag = cINTEGER + cUNIQUE           'unique unsigned integer (binary sort)
  1530.  KeyFlag = cUNIQUE + cSIGNED + cLONG    'unique signed long
  1531.  KeyFlag = cCHAR                        'character key with duplicates allowed
  1532.  KeyFlag = cCHAR + cINTEGER             'THIS IS AN INVALID KEY FLAGS!
  1533.  KeyFlag = cLONG                        'unsigned long (dups allowed)
  1534. The following values are defined in BULLET.BI (and BULLET.H):
  1535.   cUNIQUE=1, cCHAR=2, cINTEGER=&H10, cLONG=&H20, cNLS=&H4000, cSIGNED=&H8000
  1536. The NLS flag is assigned by BULLET. StatKXB is used to query KeyFlags.
  1537. See: CreateKXB_d                                                        -MORE-
  1538. ~CreateKXB_d
  1539. The key expression you specify may be up to 136 characters, and evaluate out to
  1540. 64 bytes (62 bytes if unique key is not specified). I.e, kx$ = "SUBSTR(..." can
  1541. be up to 136 characters, and that the actual key built from this expression can
  1542. be no longer that 64 bytes, or 62 if you did not specify UNIQUE. In general,
  1543. shorter keys (the key itself, not the expression) offer better performance.
  1544.                          DBF File Link Handle (XBlink)
  1545. Since BULLET evaluates the key expression at CreateKXB, it must have access to
  1546. the DBF file to verify that the key expression is valid. You must therefore
  1547. supply CreateKXB with the OS file handle of the opened DBF data file.
  1548. National Language Support (NLS)
  1549. With DOS 3.3 and later, NLS is available. BULLET uses NLS to build the collate
  1550. sequence table that it uses to ensure proper sorting of mixed-case keys as well
  1551. as the sorting of foreign language alphabets. In order for BULLET to use the
  1552. proper collate table, it must know what code page ID and coutry code to use.
  1553. This table is made part of the index file so that all subsequent access to the
  1554. index file maintains the original sort order, even if the MIS shop is moved to
  1555. another location/computer system using another country code/code page.
  1556. See: CreateKXB_e                                                        -MORE-
  1557. ~CreateKXB_e
  1558.                                 Code Page ID
  1559. To use the default code page ID of the computer in use, specify a code page ID
  1560. of -1. This instructs BULLET to use the collate-sequence table as provided by
  1561. MS-DOS running on the machine. You may also specify the code page ID for BULLET
  1562. to use, but only if support for the code page ID is available on your machine.
  1563. Look in your DOS manual under CUSTOMIZING FOR INTERNATIONAL USE for specific
  1564. code page IDs and country codes. See also the COUNTRY and NLSFUNC commands.
  1565. You may also specify a code page ID = 0 in which case no collate table is used.
  1566.                                 Country Code
  1567. To use the default country code of the computer in use, specify a country code
  1568. of -1. This instructs BULLET to use the collate-sequence table as provided by
  1569. MS-DOS running on the machine. You may also specify the country code for BULLET
  1570. to use, but only if support for the country code is available on your machine.
  1571. Look in your DOS manual under CUSTOMIZING FOR INTERNATIONAL USE for specific
  1572. code page IDs and country codes. See also the COUNTRY and NLSFUNC commands.
  1573. You may also specify a country code = 0 in which case no collate table is used.
  1574. Typically, you set CodePageID = -1, CoutryCode = -1 and CollatePtr = 0.
  1575. See: CreateKXB_f                                                        -MORE-
  1576. ~CreateKXB_f
  1577.                          User-specified Collate Table
  1578. If you are to use a MS-DOS supplied collate table (BOTH codepage ID and country
  1579. codes are non-zero) then you do not need to specify a collate table--DOS will.
  1580. The option to allow a user-specified collate table is to work around some DOS
  1581. versions supplying incorrect collate tables. If you find that the DOS-supplied
  1582. collate table is not valid (it's stored in the second sector of the file) for
  1583. your country, you can supply the table to be used by pointing the CollatePtr
  1584. variables to your in-memory version of a valid collate table. If you want to
  1585. use the DOS-supplied collate table, you MUST set the CollatePtr variables = 0.
  1586. Note: The collate table is a 256-byte table that contains the sort value of
  1587. each character (0-255). For example, the first byte would be 0, second would
  1588. be 1, and so on. Values for characters up to the lower-case letters (ASCII 97)
  1589. are usually as you would expect: "A" has a value of 65. However, the lower-case
  1590. letters have the same value as their upper-case counterparts: "a" also has a
  1591. value of 65. BULLET uses this collate table to ensure proper sorting.
  1592. If you specify EITHER code page ID OR country code = 0 then no collate table
  1593. is used or built. Instead, sorting is done by standard ASCII sort. This is
  1594. somewhat faster but less versatile. Use UPPER() for mixed-case sort if needed.
  1595. See: OpenKXB  CreateKXB
  1596. ~OpenKXB
  1597. Pack: OpenPack          Src: OpenKXBsrc         Func:  21/Mid-level
  1598. Open an existing key file for use.
  1599. Each key file that you open allocates 1264 bytes for internal use. This memory
  1600. is not deallocated until you close the file with CloseKXB or execute ExitXB.
  1601. You must open the data file before you can open its related index file.
  1602. See: CloseKXB  OpenDXB
  1603. ~CloseKXB
  1604. Pack: HandlePack        Src: CloseKXBsrc        Func:  22/Mid-level
  1605. Close an open key file. Closing the file updates the file header and
  1606. deallocates the memory used by this file.
  1607. You MUST close all BULLET files before ending your program or file corruption
  1608. may occur. To ensure that all files are closed on the event of an unscheduled
  1609. program termination, use AtExitXB.                                           
  1610. See: StatKXB  ExitXB  CloseDXB
  1611. ~StatKXB
  1612. Pack: StatKeyPack       Src: StatKXBsrc         Func:  23/Mid-level
  1613. Get basic information on a BULLET key file handle specified. Information
  1614. returned includes the number of keys in the file, the key length, the data file
  1615. handle for this key, the last accessed record number of that data file, NLS
  1616. information, and the key flags.
  1617. Typically, your program will keep track of whether a particular handle belongs
  1618. to a key file or a data file. In cases where this is not possible, call the
  1619. StatHandleXB routine to determine what file type a handle is.
  1620. See: ReadKHXB  StatDXB  StatHandleXB
  1621. ~ReadKHXB
  1622. Pack: HandlePack        Src: ReadKHXBsrc        Func:  24/Mid-level
  1623. Reload the disk copy of the key header for the opened key file handle to the
  1624. internal copy.
  1625. In single-user, single-tasking systems this routine is not needed. However, in
  1626. a multi-user or multi-tasking system it's possible, and desirable, for two or
  1627. more programs to use the same data file. Consider this scenario: A key file has
  1628. 100 keys. Two programs access this key file, both opening it. Program 1 locks
  1629. the file, adds a new key, then flushes and unlocks the file. Program 1 knows
  1630. that there are now 101 keys in the file. However, Program 2 is not aware of the
  1631. changes that Program 1 made--it thinks that there are still 100 keys in the
  1632. file. This out-of-sync situation is easily remedied by having Program 2 reload
  1633. the key header from the file on disk.
  1634. How does Program 2 know that it needs to reload the header? It doesn't. Instead
  1635. BULLET uses a simple yet effective approach when dealing with such problems.
  1636. Whenever your program locks a file, BULLET automatically reloads the header.
  1637. Whenever you unlock a file, BULLET automatically flushes the header.
  1638. See: FlushKHXB  ReadDHXB  FlushKHXB  LockXB
  1639. ~FlushKHXB
  1640. Pack: HandlePack        Src: FlushKHXBsrc       Func:  25/Mid-level
  1641. Write the internal copy of the key header for the opened key file handle to
  1642. disk. The actual write occurs only if the header has been changed.
  1643. This is to ensure that the key header on disk matches exactly the key header
  1644. that is being maintained by BULLET. Also, this routine updates the operating
  1645. system's directory entry for this file.
  1646.      
  1647. Assume the following: A data file with 100 keys. Your program opens the key
  1648. file and adds 1 key. Physically, there are 101 keys on disk. However, the
  1649. header image of the data file on disk still reads 100 keys. This isn't a
  1650. problem, BULLET uses its internal copy of the key header and the internal copy
  1651. does read 101 keys. BUT, if there were a system failure now, the disk image
  1652. would not get updated. After the system restart, BULLET opens the file, reads
  1653. the header and thinks that there are 100 keys. You lost a key. Now, if after
  1654. that add above, your program issued a FlushKHXB, the header on disk is
  1655. refreshed with the internal copy, keeping the two in-sync. Also, the routine
  1656. updates the DOS directory entry, keeping things neat there as well. Still, it
  1657. doesn't come without cost: flushing will take additional time, therefore, you
  1658. may elect to flush periodically, or whenever the system is idle.
  1659. See: CopyKHXB  ReadKHXB  FlushDHXB  LockXB
  1660. ~CopyKHXB
  1661. Pack: CopyPack          Src: CopyKHXBsrc        Func:  26/Mid-level
  1662. Copy the key file structure of an open key file to another DOS file.
  1663. This routine makes it easy for you to duplicate the structure of an existing
  1664. key file without having to specify all the information needed by CreateKXB.
  1665. The resultant key file will be exactly like the source, including key flags and
  1666. key expression. It will contain 0 keys.
  1667.      
  1668. See: ZapKHXB  CopyDHXB
  1669. ~ZapKHXB
  1670. Pack: HandlePack        Src: ZapKHXBsrc         Func:  27/Mid-level
  1671. Delete all keys for a key file.
  1672. This routine is similar to CopyKHXB except for one major difference: ALL KEYS
  1673. IN THE *SOURCE* FILE ARE PHYSICALLY DELETED, so be *careful*.
  1674. If you have a key file with 100 keys and use ZapKHXB on it, all 100 keys will
  1675. be physically deleted and the file truncated to 0 keys. There is no return from
  1676. this routine. All data is gone.
  1677.                            
  1678.                            
  1679. * C A U T I O N *
  1680.                            
  1681.      
  1682. See: GetDescriptorXB  CopyKHXB  ZapDHXB
  1683. ~GetDescriptorXB
  1684. Pack: DescriptorPack    Src: GetDescriptorXBsrc Func:  30/Mid-level
  1685. Get the field descriptor information for a field.
  1686. You can specifiy either the fieldname or the field number (position of the
  1687. field within the record where the first field is #1) to get info on.
  1688. The field descriptor contains the following information:
  1689.   FIELDNAME  10 upper-case characters, A-Z and _ allowed, unused space is
  1690.              0-filled and is 0-terminated (11 bytes, ASCII, byte 11 always=0)
  1691.   FIELDTYPE  single ASCII character where C=character, N=numeric, D=date,
  1692.              L=logical, and M=memo field (1 byte, ASCII)
  1693.   FIELDLEN   length of field: C=1-254, N=1-19, D=8 (yyyymmdd), L=1 (T/F/space),
  1694.              M=10, this is total field length (1 byte, binary)
  1695.   FIELDDC    places right of decimal point if N field type, minimum if not 0 is
  1696.              2, can be up to 6 or 8, non-N fields always 0 (1 byte, binary)
  1697. See: GetRecordXB
  1698. ~GetRecordXB
  1699. Pack: AccessPack        Src: GetRecordXBsrc     Func:  31/Mid-level
  1700. Get the physical record from the data file into a data buffer by record number.
  1701. The data buffer is typically a TYPEd variable defined as the .DBF record itself
  1702. is defined. For example, if the DBF record has 2 fields, LNAME and FNAME, then
  1703. variable would be TYPEd as:
  1704.   TYPE RecBuffer
  1705.   tag AS STRING * 1             'the Xbase DBF delete flag (must be included)
  1706.   LastName AS STRING * 25       'same field length as the .DBF LNAME field
  1707.   FirstName AS STRING * 25      'same field length as the .DBF FNAME field
  1708.   END TYPE
  1709. This method of accessing the data file does not use any indexing. Therefore, it
  1710. typically is not used except for special purposes. The preferred method to
  1711. access the data is by one of the keyed Get() routines.
  1712. See: AddRecordXB  GetEqualXB
  1713. ~AddRecordXB
  1714. Pack: AccessPack        Src: AddRecordXBsrc     Func:  32/Mid-level
  1715. Append the record in the data buffer to the end of the DBF file.
  1716. This method of adding a record does not involve any indexing. It is typically
  1717. used to build a data file en masse and do the indexing after the entire .DBF 
  1718. file(s) has been built.                                                      
  1719. If you have several thousand data records to be added at once, this method of
  1720. building the DBF first and then using the ReindexXB routine is often faster
  1721. than using the InsertXB routine for each record to add.
  1722. The AddRecordXB is very fast. 400 recs/sec on an AT machine is typical. Over
  1723. 2000 recs/sec can be added on a fast 486 machine--that's 120,000 records added
  1724. per minute.
  1725. The record number used is determined by BULLET and it is returned in AP.RecNo.
  1726. See: UpdateRecordXB  InsertXB  ReindexXB
  1727. ~UpdateRecordXB
  1728. Pack: AccessPack        Src: UpdateRecordXBsrc  Func:  33/Mid-level
  1729. Write the updated data record to the the physical record number.
  1730. This method of writing the updated record must not be used if any field(s) in
  1731. the record is used as a key field(s) and has been changed.                   
  1732. This method of updating a record is very fast if you know that that update is
  1733. not going to alter any field used as a key in any index file that uses it. You
  1734. must, of course, first get the data record into the record buffer. Then you can
  1735. change it and write the update out to disk with this routine.
  1736. If you need to change a field(s) that is used as a key field or part of one,
  1737. use the UpdateXB routine. UpdateXB not only dynamically updates all related
  1738. index files if you change a key field, it also will undo any and all changes if
  1739. an error occurs in the transaction.
  1740. See: DeleteRecordXB  GetRecordXB  UpdateXB
  1741. ~DeleteRecordXB
  1742. Pack: AccessPack        Src: DeleteRecordXBsrc  Func:  34/Mid-level
  1743. Tag the record at the physical record number as being deleted.
  1744. This does not tag any in-memory copies of the record so be sure to mark any
  1745. such copies as being deleted yourself.                                     
  1746. The first byte of every .DBF record is reserved for the delete tag. This tag
  1747. is a space (ASCII 32) if the record is normal, or a * (ASCII 48) if it's marked
  1748. as being deleted. This delete tag is a reserved field in the DBF record and as
  1749. such is not defined as a formal field with a descriptor, etc. Make sure that
  1750. you define your in-memory buffers to reserve the first byte for the delete tag.
  1751. The Xbase DBF standard doesn't physically remove records marked as deleted from
  1752. the data file. It doesn't mark them as available/reusable either. To physically
  1753. remove records marked as deleted use PackRecordsXB.
  1754. Records can be temporarily marked as deleted then recalled to normal status.
  1755. The Key/Get routines (GetFirstXB, etc.) return the record number needed for
  1756. this routine after each access in AP.RecNo.
  1757. See: UndeleteRecordXB  PackRecordsXB
  1758. ~UndeleteRecordXB
  1759. Pack: AccessPack        Src: UndeleteRecordsrc  Func:  35/Mid-level
  1760. Tag the record at the physical record number as being normal (not deleted).
  1761. This does not tag any in-memory copies of the record so be sure to mark any
  1762. such copies as being normal yourself.                                      
  1763. The first byte of every .DBF record is reserved for the delete tag. This tag
  1764. is a space (ASCII 32) if the record is normal, or a * (ASCII 48) if it's marked
  1765. as being deleted. This delete tag is a reserved field in the DBF record and as
  1766. such is not defined as a formal field with a descriptor, etc. Make sure that
  1767. you define your in-memory buffers to reserve the first byte for the delete tag.
  1768. The Xbase DBF standard does not physically remove records marked as deleted
  1769. from the data file so you can "recall" then back to normal status as easily as
  1770. you marked them deleted.
  1771. See: PackRecordsXB  DeleteRecordXB
  1772. ~PackRecordsXB
  1773. Pack: AccessPack        Src: PackRecordsXBsrc   Func:  36/Mid-level
  1774. Rebuild the open DBF file by physically removing all records marked as deleted.
  1775. Packing occurs in place using the existing file. It's recommended that you   
  1776. use BackupFileXB to copy the current DBF file before using this routine in   
  1777. case of a failure during the pack process.                                   
  1778. The newly packed file is truncated to reflect the current, actual size.
  1779. If there are index files for this .DBF file, they MUST all be reindexed after
  1780. the pack process by using ReindexXB.
  1781. This routine dynamically allocates at least as many bytes as the length of   
  1782. the record. More if available.                                               
  1783. See: FirstKeyXB  DeleteRecordXB  BackupFileXB  ReindexXB
  1784. ~FirstKeyXB
  1785. Pack: AccessPack        Src: FirstKeyXBsrc      Func:  40/Mid-level
  1786. Retrieve the first key in index order from the index file.
  1787. This routine does not access the .DBF file and so does not retrieve the data 
  1788. record. What it does do is locate the first key of the index, returning it,  
  1789. and also returning the record number within the .DBF that the key indexes.   
  1790. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1791. method, however, is to use the GetFirstXB.
  1792. The key returned includes an enumerator if a non-unique index file is involved.
  1793. The enumerator is a little-endian 16-bit value that serves to differentiate  
  1794. up to 65535 "identical", non-unique keys. It is attached to all keys of non- 
  1795. unique index files and occupies the last two bytes of the key.               
  1796. This routine is typically used to position the index file to the first key so
  1797. as to allow forward in-order access to the keys by using NextKeyXB.
  1798. See: EqualKeyXB  GetFirstXB  GetRecordXB
  1799. ~EqualKeyXB
  1800. Pack: AccessPack        Src: EqualKeyXBsrc      Func:  41/Mid-level
  1801. Search for the exact key in the index file.
  1802. This routine does not access the .DBF file and so does not retrieve the data 
  1803. record. What it does do is search for the key in the index, and if found,    
  1804. returns the record number within the .DBF that the key indexes. The key must 
  1805. be an exact match, including enumerator word if a non-unqiue index file.     
  1806. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1807. method, however, is to use the GetEqualXB.
  1808. This routine will only find EXACT matches to the specified key (including the
  1809. enumerator if applicable). However, even if the exact key is not found in the
  1810. index file, the index file is positioned so that the next NextKeyXB retrieves
  1811. the key that would have followed the unmatched specified key. For example,
  1812. if the key to match was "KINGS" (a partial key in this case), EqualKeyXB would
  1813. return a key not found error. If you were to now do a NextKeyXB, the next key
  1814. would be returned, let's say it is "KINGSTON".
  1815. See: NextKeyXB  GetEqualXB  GetRecordXB
  1816. ~NextKeyXB
  1817. Pack: AccessPack        Src: NextKeyXBsrc       Func:  42/Mid-level
  1818. Retrieve the next key in index order from the index file.
  1819. This routine does not access the .DBF file and so does not retrieve the data 
  1820. record. What it does do is retreive the next key of the index, returning it, 
  1821. and also returning the record number within the .DBF that the key indexes.   
  1822. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1823. method, however, is to use the GetNextXB.
  1824. The key returned includes an enumerator if a non-unique index file is involved.
  1825. This routine is typically called after the index file has first been positioned
  1826. to a known key using either FirstKeyXB or EqualKeyXB, or after a previous
  1827. NextKeyXB or even PrevKeyXB. What it basically does is get the key following
  1828. the current key, and then make that key the new current key.
  1829. See: PrevKeyXB  GetNextXB  GetRecordXB
  1830. ~PrevKeyXB
  1831. Pack: AccessPack        Src: PrevKeyXBsrc       Func:  43/Mid-level
  1832. Retrieve the previous key in index order from the index file.
  1833. This routine does not access the .DBF file and so does not retrieve the data 
  1834. record. What it does do is retreive the previous key of the index, returning 
  1835. it and also returning the record number within the .DBF that the key indexes.
  1836. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1837. method, however, is to use the GetPrevXB.
  1838. The key returned includes an enumerator if a non-unique index file is involved.
  1839. This routine is typically called after the index file has first been positioned
  1840. to a known key using either LastKeyXB or EqualKeyXB, or after a previous
  1841. PrevKeyXB or even NextKeyXB. What it basically does is to get the key previous
  1842. the current key, and then make that key the new current key.
  1843. See: LastKeyXB  GetPrevXB  GetRecordXB
  1844. ~LastKeyXB
  1845. Pack: AccessPack        Src: LastKeyXBsrc       Func:  44/Mid-level
  1846. Retrieve the last key in index order from the index file.
  1847. This routine does not access the .DBF file and so does not retrieve the data 
  1848. record. What it does do is locate the last key of the index, returning it,   
  1849. and also returning the record number within the .DBF that the key indexes.   
  1850. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1851. method, however, is to use the GetLastXB.
  1852. This routine is typically used to position the index file to the last key so as
  1853. to allow reverse in-order access to the keys by using PrevKeyXB.
  1854. See: StoreKeyXB  GetLastXB  GetRecordXB
  1855. ~StoreKeyXB
  1856. Pack: AccessPack        Src: StoreKeyXBsrc      Func:  45/Mid-level
  1857. Insert the key into the index file in proper key order.
  1858. This routine does not add the data record to the .DBF file. It only inserts  
  1859. the key and record number into the index file. Use InsertXB, instead.        
  1860. To do a complete data record and key insert, you could use AddRecordXB to add
  1861. the data record to the .DBF, BuildKeyXB to construct the key, then StoreKeyXB
  1862. to insert the key and record number information into the index file. If that
  1863. key already exists and the file allows duplicate keys, you need to attach the
  1864. proper enumerator word and retry StoreKeyXB.
  1865. This is much too much to do. Instead, just use InsertXB. All these details
  1866. including adding the data record and multi-key inserts are performed
  1867. automatically with just the single call.
  1868. See: DeleteKeyXB  InsertXB
  1869. ~DeleteKeyXB
  1870. Pack: AccessPack        Src: DeleteKeyXBsrc     Func:  46/Mid-level
  1871. Physically remove the specified key from the index file.
  1872. This routine requires an EXACT key match for all bytes of the key, including 
  1873. the enumerator word if a non-unique index file is involved.                  
  1874. This routine would seldom be used, typically, since deleted dBASE data records
  1875. are only physically deleted during a PackRecordsXB and the index file is
  1876. rebuilt afterward using ReindexXB.
  1877. See: BuildKeyXB  CurrentKeyXB
  1878. ~BuildKeyXB
  1879. Pack: AccessPack        Src: BuildKeyXBsrc      Func:  47/Mid-level
  1880. Build the key for the specifed data record based on the key expression for the
  1881. index file. If the index file is non-unique, a 0-value enumerator is attached.
  1882. The enumerator is a little-endian 16-bit value that serves to differentiate  
  1883. up to 65535 "identical", non-unique keys. It is attached to all keys of non- 
  1884. unique index files and occupies the last two bytes of the key.               
  1885. This routine, like most of the mid-level routines, typically would not be used
  1886. since the high-level access routines take care of this detail automatically.
  1887. See: CurrentKeyXB  StoreKeyXB
  1888. ~CurrentKeyXB
  1889. Pack: AccessPack        Src: CurrentKeyXBsrc    Func:  48/Mid-level
  1890. Retrieve the current key value for the specified key file handle and also the
  1891. data record number that it indexes.
  1892. This routine is useful in that it retrieves on demand the actual key value of
  1893. the last accessed key in the index file (and the data record number). Most
  1894. often you don't need this information so it would be a waste of time and space
  1895. for your program to explicitly track each current key for each index file that
  1896. you have open.
  1897. See: GetFirstXB  ReindexXB  DeleteKeyXB
  1898. ~GetFirstXB
  1899. Pack: AccessPack        Src: GetFirstXBsrc      Func:  60/High-level
  1900. Retrieve the first indexed key and data record.
  1901. The key returned includes an enumerator if a non-unique index file is involved.
  1902. This routine is typically used to process a database in index order starting at
  1903. the first ordered key (and its data record). After processing this first entry,
  1904. subsequent in-order access of the database is achieved by using GetNextXB until
  1905. the end of the database is reached.
  1906. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1907. the record accessed. In GetFirstXB's case, it fills AP.RecNo with the record
  1908. number pointed to by the first key. Since this is so, the AP pack is primed for
  1909. an UpdateXB after each high-level Get. Other methods to get the record number
  1910. are to use CurrKeyXB or any of the Key routines (KeyFirstXB, etc.).
  1911. See: GetEqualXB  FirstKeyXB  UpdateXB
  1912. ~GetEqualXB
  1913. Pack: AccessPack        Src: GetEqualXBsrc      Func:  61/High-level
  1914. Search for the exact key in the index file and return its data record.
  1915. This routine will only find EXACT matches to the specified key (including the
  1916. enumerator if applicable). However, even if the exact key is not found in the
  1917. index file, the index file is positioned so that the next GetNextXB retrieves
  1918. the key that would have followed the unmatched specified key. For example,
  1919. if the key to match was "KINGS" (a partial key in this case), GetEqualXB would
  1920. return a key not found error. If you were to now do a GetNextXB, the next key
  1921. and data record would be returned, let's say the key is "KINGSTON" and its data
  1922. record is the data record for that key. Another GetNextXB would retrieve the
  1923. key and record after that. (GetPrevXB can be used in this fashion too.)
  1924. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1925. the record accessed. In GetEqualXB's case, it fills AP.RecNo with the record
  1926. number pointed to by the matched key. Since this is so, the AP pack is primed
  1927. for an UpdateXB after each high-level Get. Other methods to get the record
  1928. number are to use CurrKeyXB or any of the Key routines (KeyEqualXB, etc.).
  1929. See: GetNextXB  EqualKeyXB
  1930. ~GetNextXB
  1931. Pack: AccessPack        Src: GetNextXBsrc       Func:  62/High-level
  1932. Retrieve the next indexed key and its data record.
  1933. The key returned includes an enumerator if a non-unique index file is involved.
  1934. This routine is typically calld after the index file has first been positioned
  1935. to a known key using either GetFirstXB or GetEqualXB, or after a previous
  1936. GetNextXB or even GetPrevXB. What it basically does is get the key and data
  1937. record following the current key, and then make that key the new current key.
  1938. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1939. the record accessed. In GetNextXB's case, it fills AP.RecNo with the record
  1940. number pointed to by the next key. Since this is so, the AP pack is primed for
  1941. an UpdateXB after each high-level Get. Other methods to get the record number
  1942. are to use CurrKeyXB or any of the Key routines (KeyNextXB, etc.).
  1943. See: GetPrevXB  NextKeyXB
  1944. ~GetPrevXB
  1945. Pack: AccessPack        Src: GetPrevXBsrc       Func:  63/High-level
  1946. Retrieve the previous indexed key and record.
  1947. The key returned includes an enumerator if a non-unique index file is involved.
  1948. This routine is typically called after the index file has first been positioned
  1949. to a known key using either GetLastXB or GetEqualXB, or after a previous
  1950. GetPrevXB or even GetNextXB. What it basically does is to get the key and data
  1951. record previous the current key, and then make that key the new current key.
  1952. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1953. the record accessed. In GetPrevXB's case, it fills AP.RecNo with the record
  1954. number pointed to by the previous key. Since this is so, the AP pack is primed
  1955. for an UpdateXB after each high-level Get. Other methods to get the record
  1956. number are to use CurrKeyXB or any of the Key routines (KeyPrevXB, etc.).
  1957. See: GetLastXB  PrevKeyXB
  1958. ~GetLastXB
  1959. Pack: AccessPack        Src: GetLastXBsrc       Func:  64/High-level
  1960. Retrieve the last indexed key and record.
  1961. This routine is typically used to process a database in reverse index order
  1962. starting at the last ordered key (and its data record). After processing this
  1963. last entry, subsequent reverse-order access of the database is achieved by
  1964. using GetPrevXB until the top of the database is reached.
  1965. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1966. the record accessed. In GetLastXB's case, it fills AP.RecNo with the record
  1967. number pointed to by the last key. Since this is so, the AP pack is primed for
  1968. an UpdateXB after each high-level Get. Other methods to get the record number
  1969. are to use CurrKeyXB or any of the Key routines (KeyLastXB, etc.).
  1970. See: InsertXB  LastKeyXB
  1971. ~InsertXB
  1972. Pack: AccessPack        Src: InsertXBsrc        Func:  65/High-level
  1973. Add the data record to data file and insert the related key(s) into the linked
  1974. index file(s).
  1975. This routine is used to add new entries into a database, one at a time. The
  1976. data record is first added to the data file, then for each related index file,
  1977. a key is inserted into the appropriate index file. Up to 32 index files can be
  1978. automatically maintained for each data file.
  1979. This and several other routines are transaction-based. If a failure occurs   
  1980. prior to the routine's completion, all changes made to the database by the   
  1981. routine will be backed-out and the database (data and related index file(s)) 
  1982. effectively restored to its original state.                                  
  1983. If the routine failed to complete, the function return value is the number of
  1984. the pack that caused the failure. That pack's Stat is checked to determine the
  1985. error code. If the function return value is 0, you must still check the first
  1986. pack's Stat. If it's non-zero, then the failure occured with the data record.
  1987. See: UpdateXB  StoreKeyXB
  1988. ~UpdateXB
  1989. Pack: AccessPack        Src: UpdateXBsrc        Func:  66/High-level
  1990. Modify an existing data record (identified by record number) and automatically
  1991. perform any index file updates needed to keep the index file(s) in sync.
  1992. If any key fields changed between the original record and the new one, this
  1993. routine updates the appropriate index file(s) by replacing the original key(s)
  1994. with new the key(s) based on the updated data record. Up to 32 index files can
  1995. be automatically maintained for each data file. Get routines (GetFirstXB, etc.)
  1996. set the AP.RecNo of the record that UpdateXB uses.
  1997. This and several other routines are transaction-based. If a failure occurs   
  1998. prior to the routine's completion, all changes made to the database by the   
  1999. routine will be backed-out and the database (data and related index file(s)) 
  2000. effectively restored to its original state.                                  
  2001. If the routine failed to complete, the function return value is the number of
  2002. the pack that caused the failure. That pack's Stat is checked to determine the
  2003. error code. If the function return value is 0, you must still check the first
  2004. pack's Stat. If it's non-zero, then the failure occured with the data record.
  2005. See: ReindexXB  UpdateRecordXB
  2006. ~ReindexXB
  2007. Pack: AccessPack        Src: ReindexXBsrc       Func:  67/High-level
  2008. Reindex all related index files for a data file.
  2009. The index file(s) must already exist and be open. Any existing key data is
  2010. overwritten by the new key data. In other words, if you have a 10MByte index
  2011. file, ReindexXB uses the same file space building the news keys over the old.
  2012. This results in a less fragmented disk and also minimizes disk space needed.
  2013. You can also create a new, empty index file and reindex to that. This would be
  2014. useful, for instance, if you needed to create a temporary index file--something
  2015. that you'd use for a report, say, then delete after the report.
  2016. This routine creates a TEMPORARY work file in either the current directory or,
  2017. if the DOS environment variable TMP is defined, in the TMP= directory. The size
  2018. of this file is approx. bytes = (RECORDS * (KEYLEN+6)). ReindexXB can operate
  2019. in as little as 32K of available memory and can use up to 128K. The resultant
  2020. index file(s) are optimized for minimum size AND maximum retrieval speed.
  2021. If the routine failed to complete, the function return value is the number of
  2022. the pack that caused the failure. That pack's Stat is checked to determine the
  2023. error code. A return value of zero indicates no error occured.
  2024. See: LockXB  PackRecordsXB
  2025. ~LockXB
  2026. Pack: AccessPack        Src: LockXBsrc          Func:  80/Network
  2027. Lock all bytes in the index file handle(s) for exclusive use by the current
  2028. process and reload the index file header(s) from disk. Also lock all bytes in
  2029. the related data file and reload the data file header from disk.
  2030. The files must have been opened with the appropriate share attribute and not 
  2031. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2032. This routine is transaction-based and will lock all index files specified in
  2033. AccessPack and the data file. If any lock fails, all previous locks by this
  2034. routine are released. The return value indicates which access pack failed, if
  2035. any. This value is used as the index into the AccessPack group for you to
  2036. identify the error code. See LockXBsrc for determining this exactly.
  2037. Use the DriveRemoteXB and/or FileRemoteXB to determine if locking is necessary.
  2038. If the files are on a remote drive then it is best to use locking. Locking may
  2039. also be necessary on multitasking local machines accessing shared files.
  2040. This routine is a combination of LockKeyXB and LockDataXB.
  2041. See: UnlockXB  LockKeyXB  LockDataXB  DriveRemoteXB  FileRemoteXB
  2042. ~UnlockXB
  2043. Pack: AccessPack        Src: UnlockXBsrc        Func:  81/Network
  2044. Unlock all bytes in the specified file handle(s) (previously locked) and flush
  2045. the file header(s) to disk (flush done before lock(s) released). Also unlock
  2046. all bytes in the related data file and flush the data file header to disk.
  2047. The files must have been opened with the appropriate share attribute and not 
  2048. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2049. This routine is transaction-based and will unlock all index files specified in
  2050. AccessPack and the data file. If an unlock fails the routine exits with a
  2051. return value indicating which access pack failed. This value is used as the
  2052. index into the AccessPack group for you to identify the error code. Note that
  2053. this routine does not attempt to re-lock those files unlocked successfully if
  2054. an error occurs in the transaction. If an error does occur (unlikely) you will
  2055. need to provide for unlocking the remaining files manually with the UnlockKeyXB
  2056. and UnlockDataXB routines. You should not rely on the operating system to
  2057. automatically unlock files when they're closed.
  2058. This routine is a combination of UnlockKeyXB and UnlockDataXB.
  2059. See: LockKeyXB  UnlockKeyXB  UnlockDataXB
  2060. ~LockKeyXB
  2061. Pack: AccessPack        Src: LockKeyXBsrc       Func:  82/Network
  2062. Lock all bytes in the index file handle(s) for exclusive use by the current
  2063. process and reload the index file header(s) from disk.
  2064. The files must have been opened with the appropriate share attribute and not 
  2065. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2066. This routine is transaction-based and will lock all index files specified in
  2067. AccessPack. If any lock fails, all previous locks by this routine are released.
  2068. The return value indicates which access pack failed, if any. This value is used
  2069. as the index into the AccessPack group for you to identify the error code.
  2070. The advantage of using region locks (LockKeyXB locks the entire file region) to
  2071. control file access is that the file does not need to be opened/closed using
  2072. the Deny Read/Write sharing attribute. Opening the file for Deny None, and
  2073. controlling subsequent access with region locks, allows for faster processing
  2074. since files do not need to be constantly opened and closed, as they would if
  2075. access were controlled by opening with Deny Read/Write.
  2076. See: UnlockKeyXB  LockXB
  2077. ~UnlockKeyXB
  2078. Pack: AccessPack        Src: UnlockKeyXBsrc     Func:  83/Network
  2079. Unlock all bytes in the specified file handle(s) (previously locked) and flush
  2080. the file header(s) to disk (flush done before lock(s) released).
  2081. The files must have been opened with the appropriate share attribute and not 
  2082. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2083. This routine is transaction-based and will unlock all index files specified in
  2084. AccessPack. If an unlock fails the routine exits with a return value indicating
  2085. which access pack failed. This value is used as the index into the AccessPack
  2086. group for you to identify the error code.
  2087. All file locks should be released when exclusive access in no longer needed. 
  2088. It is not recommended that you end your program without having released active
  2089. file locks. This is especially a valid concern for DOS versions prior to 5.0.
  2090. DOS 5 releases locks on files that are closed.
  2091. See: LockDataXB  UnlockXB
  2092. ~LockDataXB
  2093. Pack: AccessPack        Src: LockDataXBsrc      Func:  84/Network
  2094. Lock all bytes in the file handle's data file for exclusive use by the current
  2095. process and reload the data file header from disk.
  2096. The files must have been opened with the appropriate share attribute and not 
  2097. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2098. This routine locks the specified data file. If the handle specified is that of
  2099. an index file, that index file's related data file handle is used.
  2100. The advantage of using region locks (LockDataXB locks the entire file region)
  2101. to control file access is that the file does not need to be opened/closed using
  2102. the Deny Read/Write sharing attribute. Opening the file for Deny None, and
  2103. controlling subsequent access with region locks, allows for faster processing
  2104. since files do not need to be constantly opened and closed, as they would if
  2105. access were controlled by opening with Deny Read/Write.
  2106. LockXB calls this and the LockKeyXB routine and should be simpler to use if you
  2107. need to lock both data and index files.
  2108. See: UnlockDataXB
  2109. ~UnlockDataXB
  2110. Pack: AccessPack        Src: UnlockDataXBsrc    Func:  85/Network
  2111. Unlock all bytes in the specified file handle (previously locked) and flush the
  2112. data file header to disk (flush done before lock released).
  2113. The files must have been opened with the appropriate share attribute and not 
  2114. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  2115. This routine unlocks the specified data file. If the handle specified is that
  2116. of an index file, that index file's related data file handle is used.
  2117. All file locks should be released when exclusive access in no longer needed. 
  2118. It is not recommended that you end your program without having released active
  2119. file locks. This is especially a valid concern for DOS versions prior to 5.0.
  2120. DOS 5 releases locks on files that are closed.
  2121. UnlockXB calls this and the UnlockKeyXB routine and should be simpler to use if
  2122. you need to unlock both data and index files.
  2123. See: DriveRemoteXB
  2124. ~DriveRemoteXB
  2125. Pack: RemotePack        Src: DriveRemoteXBsrc   Func:  86/Network
  2126. Determine if specified drive is remote (default drive=0, A:=1, B=2, C=3...).
  2127. This routine uses INT21/44/sub function 09.
  2128. In addition to returning the IsRemote state, this routine sends back the result
  2129. of the DX register and also the install state of SHARE.EXE.
  2130. The meaning of the bitflags in Flags are (where IsRemote=0):
  2131. Bit   Meaning drive...
  2132.  1   1=uses 32-bit sectoring
  2133.  6   1=accepts Generic IOCTL (for INT21/44/0D,0E,0Fh)
  2134.  7   1=accepts Query IOCTL Device (INT21/44/11h)
  2135.  9   1=is local but shared by other computers in the network
  2136. 11   1=accepts Does-Device-Use-Removable-Media (INT21/44/08)
  2137. 13   1=requires media descriptor in FAT
  2138. 14   1=accepts Receive/Send Control Data from Block Device (INT21/44/04,05)
  2139. 15   1=is Substitution drive (set by the DOS SUBST command)
  2140.      (all other bits=0)
  2141. See: FileRemoteXB  LockXB
  2142. ~FileRemoteXB
  2143. Pack: RemotePack        Src: FileRemoteXBsrc    Func:  87/Network
  2144. Determine if specified handle of file or device is remote.
  2145. This routine uses INT21/44/sub function 0Ah.
  2146. In addition to returning the IsRemote state, this routine sends back the result
  2147. of the DX register and also the install state of SHARE.EXE.
  2148. Flags bit 7=1 then handle is device, =0 then handle is file.
  2149. Bit   Meaning DEVICE...                 Bit   Meaning DEVICE...(cont)
  2150.  0   1=is console input device          13   1=is named pipe
  2151.  1   1=is console output device         15   1=is remote, 0=is local
  2152.  2   1=is null device                        (all other bits=0)
  2153.  3   1=is clock device                  Bit   Meaning FILE...
  2154.  4   1=is special device               0-5   xxxxxx=drive number (0=A...)
  2155.  5   1=is in binary mode, 0=in ASCII     6   1=has not been written to
  2156.  6   0=returns EOF if device is read    12   1=is NoInherit
  2157. 11   1=is network spooler               14   1=date/time not set at close
  2158. 12   1=is NoInherit                     15   1=is remote, 0=is local
  2159.                                              (all other bits=0)
  2160. See: SetRetriesXB  DriveRemoteXB  LockXB
  2161. ~SetRetriesXB
  2162. Pack: SetRetriesPack    Src: SetRetriesXBsrc    Func:  88/Network
  2163. Set the number of times DOS retries disk operations after a failure due to
  2164. file-sharing operations (locked file regions from LockXB routines).
  2165. This routine uses INT21/44/sub function 0Bh.
  2166. By default DOS retries an operation 3 times (without pausing between attempts)
  2167. before returning an error to the application.
  2168. If you change the default values it's recommended that the default state be  
  2169. restored before your application ends (Retries=3, Pause=1).                  
  2170. These values are pretty much determined by trial-and-error. You may find that
  2171. adding a delay between retries returns fewer access-denied errors.
  2172. See: DeleteFileDOS  LockXB
  2173. ~DeleteFileDOS
  2174. Pack: DOSFilePack       Src: DeleteFileDOSsrc   Func: 100/DOS
  2175. Delete the specified file.
  2176. This routine uses DOS INT21/41 (interrupt 21h function 41h).
  2177. See: RenameFileDOS
  2178. ~RenameFileDOS
  2179. Pack: DOSFilePack       Src: RenameFileDOSsrc   Func: 101/DOS
  2180. Rename a file. May also be used to move the file to a new directory within the
  2181. partition.
  2182. This routine uses DOS INT21/56.
  2183. If the specified directory differs from the file's directory, the file's     
  2184. directory entry is moved to the new directory.                               
  2185. For example, if the FilenamePtr filename is C:\LP100\PROJ93A.INF and the
  2186. NewFilenamePtr filename is C:\ARCH\PROJ93A.INA, the file is essentially
  2187. renamed and also moved to the \ARCH directory.
  2188. See: CreateFileDOS
  2189. ~CreateFileDOS
  2190. Pack: DOSFilePack       Src: CreateFileDOSsrc   Func: 102/DOS
  2191. Create a new file.
  2192. This routine uses INT21/3C.
  2193. The specified filename/pathname must NOT already exist.
  2194. The file created is not left open. You must OpenFileDOS to use it.
  2195. The attribute used during the create can be:
  2196.   ATTRIBUTE       VALUE    MEANING
  2197.    Normal              0    normal access permitted to file
  2198.    Read-Only           1    read-only access permitted to file
  2199.    Hidden              2    file does not appear in directory listing
  2200.    System              4    file is a system file
  2201.    Volume              8    FILENAME used as volume label if no current label
  2202.    Archive            20h   file is marked for archiving
  2203. See: AccessFileDOS  OpenFileDOS
  2204. ~AccessFileDOS
  2205. Pack: DOSFilePack       Src: AccessFileDOSsrc   Func: 103/DOS
  2206. Determine if the specified file can be accessed with the specified
  2207. access/sharing mode.
  2208. This routine uses INT21/3D and INT21/3E.
  2209. Basically, a Does-File-Exist routine. It uses the specified access/sharing
  2210. attributes when trying to open the file. For example, if you specify
  2211. DFP.Attr = &H42 (R/W access + Deny None sharing) and use AccessFileDOS on a
  2212. Read-Only DOS file, the return value would be DOS error 5, Access Denied.
  2213. See: OpenFileDOS
  2214. ~OpenFileDOS
  2215. Pack: DOSFilePack       Src: OpenFileDOSsrc     Func: 104/DOS
  2216. Open the specified file with the specified access/sharing mode.
  2217. This routine uses INT21/3D.
  2218.   ACCESS          VALUE    MEANING
  2219.    Read-only           0    open for read-only access
  2220.    Write-only          1    open for write-only access
  2221.    Read/Write          2    open for read/write access
  2222.   SHARE
  2223.    Compatibility       0     any process may share file (not recommended)
  2224.    Deny Read/Write    10h    no other process may share file
  2225.    Deny Write         20h    no other process may share file for write
  2226.    Deny Read          30h    no other process may share file for read
  2227.    Deny None          40h    any process may share file except in Compatibilty
  2228.   INHERIT                                                                 mode
  2229.    NoInheritFlag      80h    if set child processes do not inherit file handles
  2230.                              (child process cannot inherit handle > 20)
  2231. The file access mode is a combination of ACCESS + SHARE + INHERIT.
  2232. See: SeekFileDOS  OpenPack
  2233. ~SeekFileDOS
  2234. Pack: DOSFilePack       Src: SeekFileDOSsrc     Func: 105/DOS
  2235. Position the DOS file pointer of the specified file to the specified position.
  2236. This routine uses INT21/42.
  2237. The position is a 32-bit value and is relative to either the start of the file,
  2238. the current file pointer position, or the end of the file.
  2239.  Method  Meaning
  2240.     0    start move from the start of file (offset is a 32-bit unsigned value)
  2241.     1    start move at the current position (offset a signed value)
  2242.     2    start move at the end of file (offset a signed value)
  2243. For example, to move to the 511th byte of a file (byte 0 being the first), set
  2244. the offset value to 511 and use Method 0. On return, the absolute offset value
  2245. of the new position is returned. This is useful with Method 2 since you can
  2246. specify an offset of 0 and have the file length returned.
  2247. Never position the file pointer to before the start of file.                 
  2248. See: ReadFileDOS
  2249. ~ReadFileDOS
  2250. Pack: DOSFilePack       Src: ReadFileDOSsrc     Func: 106/DOS
  2251. Read from the file or device the specified number of bytes into a buffer.
  2252. This routine uses INT21/3F.
  2253. On block devices (such as disks) input starts at the current file position and
  2254. the file pointer is repositioned to the last byte read +1.
  2255. It is possible to read less than the bytes specified without an error being  
  2256. generated. Compare the bytes to read with the returned bytes read value. If  
  2257. less then end of file was reached during the read, if 0 then file was at EOF.
  2258. By using DOS's predefined handles you can read from the keyboard (STDIN) by
  2259. using the STDIN handle, 0. The input will terminate after all specified bytes
  2260. have been read or after a CR (ASCII 0Dh). If more bytes are entered than were
  2261. requested, the next read will retrieve those excess bytes. Therefore, it's
  2262. suggested that you specify 129 bytes to input (DOS will process 127+CR/LF bytes
  2263. maximum when reading the STDIN device). Post-process the entered data by
  2264. scanning for the CR/LF.
  2265. See: ExpandFileDOS
  2266. ~ExpandFileDOS
  2267. Pack: DOSFilePack       Src: ExpandFileDOSsrc   Func: 107/DOS
  2268. Expands the specified file by the specified number of bytes.
  2269. This routine uses INT21/42 and INT21/40.
  2270. This routine is useful in pre-allocating disk space. By reserving disk space in
  2271. advance you can guarantee that enough disk space will be available for a future
  2272. operation (especially if more than 1 process is running). You'll also be able
  2273. ensure that the disk space that a file does use is as contiguous as possible.
  2274. Database systems are dynamic and their files typically allocate new space on
  2275. an as-needed basis. This dynamic allocation can cause parts of a file to be
  2276. located throughout the disk system, possibly affecting performance drastically.
  2277. By pre-allocating the disk space you can be assured of consistent throughput
  2278. performance since the file is contiguous.
  2279. See: WriteFileDOS
  2280. ~WriteFileDOS
  2281. Pack: DOSFilePack       Src: WriteFileDOSsrc    Func: 108/DOS
  2282. Write to the file or device the specified number of bytes from a buffer.
  2283. This routine uses INT21/40.
  2284. If the number of bytes written is less than the specified bytes, this routine
  2285. returns a -2 error code (or 65554 unsigned).                                 
  2286. On block devices (such as disk) output starts at the current file position, and
  2287. the file pointer is repositioned to the last byte written +1.
  2288. If the specified bytes to write is 0, the file is truncated at the current   
  2289. file pointer position.                                                       
  2290. By using DOS's predefined handles you can write to the screen (STDOUT) by
  2291. using the STDOUT handle, 1.
  2292. See: CloseFileDOS
  2293. ~CloseFileDOS
  2294. Pack: DOSFilePack       Src: CloseFileDOSsrc    Func: 109/DOS
  2295. Close the file flushing any internal buffers, releasing any locked regions, and
  2296. update the directory entry to the correct size, date, and time.
  2297. This routine uses INT21/3E.
  2298. If you have opened a file using the DOS open routine you should close it when
  2299. you no longer need it.
  2300. This routine can be used to close the predefined DOS handles (0-4) and make  
  2301. those handles available for reuse. Typically handles 0 and 1 should not be   
  2302. closed by an application since they are the STDIN and STDOUT that DOS uses   
  2303. for the current application (keyboard and screen).                           
  2304. Since BULLET provides for up to 250 user file handles for your applications it
  2305. isn't necessary for you to eek 3 more file handles by closing handles 2-4.
  2306. See: MakeDirDOS
  2307. ~MakeDirDOS
  2308. Pack: DOSFilePack       Src: MakeDirDOSsrc      Func: 110/DOS
  2309. Create a new subdirectory.
  2310. This routine uses INT21/39.
  2311. See: DeleteFileDOS
  2312. ~AccessPack
  2313.  Src: InsertXBsrc      Func: InsertXB and many more
  2314. TYPE AccessPack            'AP (AP is recommended pack name for DIM, AP.Func=)
  2315. Func AS INTEGER            'varies
  2316. Stat AS INTEGER            'ret:completion status
  2317. Handle AS INTEGER          'OS handle
  2318. RecNo AS LONG              ' in:rec number to get/delete/update (if applicable)
  2319.                            'ret:record number of data record accessed
  2320. RecPtrOff AS INTEGER       'far pointer to record storage buffer
  2321. RecPtrSeg AS INTEGER
  2322. KeyPtrOff AS INTEGER       'far pointer to search key buffer
  2323. KeyPtrSeg AS INTEGER
  2324. NextPtrOff AS INTEGER      'far pointer to next key access pack
  2325. NextPtrSeg AS INTEGER      'or 0:0 if end of link or if N/A
  2326. END TYPE  '22
  2327. Used by many BULLET routines. The NextPtr variables are only used by InsertXB,
  2328. UpdateXB, ReindexXB, and the LockXB routines. NextPtr is used as a link to the
  2329. next related access pack, if any.  Not all entries are used by all routines.
  2330. Generally, any routine that gets/puts user data to the database uses this pack.
  2331. See: BreakPack
  2332. ~BreakPack
  2333.  Src: BreakXBsrc       Func: BreakXB
  2334. TYPE BreakPack             'BP
  2335. Func AS INTEGER            '4
  2336. Stat AS INTEGER            'ret:completion status
  2337. Mode AS INTEGER            '=0 disable Ctrl-C/Ctrl-Break, 1=restore
  2338. END TYPE '6 bytes
  2339. A simple pack.
  2340. See: CopyPack
  2341. ~CopyPack
  2342.  Src: BackupFileXBsrc  Func: BackupFileXB, CopyDHXB, CopyKHXB
  2343. TYPE CopyPack              'CP
  2344. Func AS INTEGER            '5=BackupFileXB,16=CopyDHXB,26=CopyKHXB
  2345. Stat AS INTEGER            'ret:completion status
  2346. Handle AS INTEGER          'handle of BULLET file
  2347. FilenamePtrOff AS INTEGER  'far pointer to filenameZ
  2348. FilenamePtrSeg AS INTEGER  '(filename must end with a CHR$(0)))
  2349. END TYPE '10
  2350. See: CreateDataPack
  2351. ~CreateDataPack
  2352.  Src: CreateDXBsrc     Func: CreateDXB
  2353. TYPE CreateDataPackTYPE    'CDP
  2354. Func AS INTEGER            '10
  2355. Stat AS INTEGER            'ret:completion status
  2356. FilenamePtrOff AS INTEGER  'far pointer to filenameZ to create
  2357. FilenamePtrSeg AS INTEGER  '(filename must end with a CHR$(0))
  2358. NoFields AS INTEGER        'number of fields per record
  2359. FieldListPtrOff AS INTEGER 'far pointer to field list
  2360. FieldListPtrSeg AS INTEGER '(field list is of type FieldDescTYPE )
  2361. FileID AS INTEGER          'file signature byte, usually=3
  2362. END TYPE '16
  2363. The filename pointed at by the FilenamePtr variables should be a fixed-length
  2364. string (e.g., FILEN AS STRING * 80) so that VARSEG/VARPTR can be used to get
  2365. its memory address. The filename must end with a CHR$(0) immediately following
  2366. the last character of the filename: FILEN = YourFilename$ + CHR$(0).
  2367. The FieldListPtr variables point to an array of type FieldDescTYPE. This array
  2368. is dimensioned for as many fields as there are in the record and contains the
  2369. field descriptors, one for each field.
  2370. See: CreateKeyPack  FieldDescTYPE
  2371. ~CreateKeyPack
  2372.  Src: CreateKXBsrc     Func: CreateKXB
  2373. TYPE CreateKeyPack         'CKP
  2374. Func AS INTEGER            '20
  2375. Stat AS INTEGER            'ret:completion status
  2376. FilenamePtrOff AS INTEGER  'far pointer to filenameZ
  2377. FilenamePtrSeg AS INTEGER  '(filename must end with a CHR$(0))
  2378. KeyExpPtrOff AS INTEGER    'far pointer to key expressionZ
  2379. KeyExpPtrSeg AS INTEGER    '(key expression must end with a CHR$(0))
  2380. XBlink AS INTEGER          'BULLET XB data file handle this key file indexes
  2381. KeyFlags AS INTEGER        'bit 0=unique,1=char,4=int,5=long,(E=NLS),F=signed
  2382. CodePageID AS INTEGER      'code page ID for NLS, -1 to use system default
  2383. CountryCode AS INTEGER     'country code number for NLS, -1 to use default
  2384. CollatePtrOff AS INTEGER   'far pointer to programmer-supplied collate table
  2385. CollatePtrSeg AS INTEGER   'or 0:0 if using system-determined NLS table
  2386. END TYPE '24
  2387. Bit 14 in KeyFlags (0Eh) is set by BULLET during CreateKXB if a collate table
  2388. is present.
  2389. See: DescriptorPack  is_NLS
  2390. ~DescriptorPack
  2391.  Src: GetDescriptorXBsrc  Func: GetDescriptorXB
  2392. TYPE DescriptorPack        'DP
  2393. Func AS INTEGER            '30
  2394. Stat AS INTEGER            'ret:completion status
  2395. Handle AS INTEGER          'BULLET data file handle to get information on
  2396. FieldNumber AS INTEGER     'field number to get info on, or if 0 then...
  2397. FD AS FieldDescTYPE        '...search for DP.FD.FieldName
  2398. END TYPE '40
  2399. GetDescriptorXB allows you to get the field descriptor info for a particular
  2400. field number (as in the first field, or the 10th field, etc.) or, if you don't
  2401. know the physical field number, the routine can also get the info for a field
  2402. by field name.
  2403. To get the info for field number, say 5, set DP.FieldNumber = 5. The DP.FD
  2404. structure element is filled in with field 5's information.
  2405. To get the info for a field by fieldname, say LASTNAME, set DP.FieldNumber=0 &
  2406. DP.FD.FieldName = "LASTNAME" + STRING$(11,0)--the fieldname must be zero-filled
  2407. and zero-terminated--adding 11 ASCII zeroes ensures this requirement.
  2408. See: DOSFilePack  FieldDescTYPE
  2409. ~DOSFilePack
  2410.  Src: AccessFileDOSsrc  Func: AccessFileDOS
  2411.                               (all routines ending with DOS)
  2412. TYPE DOSFilePack           'DFP
  2413. Func AS INTEGER            'varies, see DeleteFileDOS for first of DOS routines
  2414. Stat AS INTEGER            'ret:completion status
  2415. FilenamePtrOff AS INTEGER  'far pointer to filenameZ
  2416. FilenamePtrSeg AS INTEGER  '(filename must end with a CHR$(0))
  2417. Handle AS INTEGER          'in: handle to access  ret: handle opened
  2418. ASmode AS INTEGER          'open access/sharing mode
  2419. Bytes AS INTEGER           'in: bytes to read  ret: bytes read
  2420. SeekOffset AS LONG         'seek to file position
  2421. Method AS INTEGER          'seek method
  2422. BufferPtrOff AS INTEGER    'far pointer to read/write buffer
  2423. BufferPtrSeg AS INTEGER
  2424. Attr AS INTEGER            'file create directory entry attribute
  2425. NewNamePtrOff AS INTEGER   'far pointer to new filenameZ for rename
  2426. NewNamePtrSeg AS INTEGER   '(filename must end with a CHR$(0))
  2427. END TYPE '30
  2428. All of the xDOS routines use this pack. Often only a few of the structure
  2429. elements are used by any one of the routines. Set only those needed.
  2430. See: DVmonPack
  2431. ~DVmonPack
  2432.  Src: DVmonCXBsrc      Func: DVmonCXB
  2433. TYPE DVmonPackTYPE         'THIS ROUTINE IS AVAILABLE ONLY IN THE DEBUG ENGINE
  2434. Func AS INTEGER            '9
  2435. Stat AS INTEGER            'ret:completion status
  2436. Mode AS INTEGER            '=0 disable montitoring, =1 enable
  2437. Handle AS INTEGER          'file handle to monitor
  2438. VideoSeg AS INTEGER        'segment to write screen image (e.g., &HB800)
  2439. END TYPE '10 bytes
  2440. This routine is supplied only in the BULLET debug engine. It displays real-time
  2441. monitoring information of a .DBF file or index and .DBF file pair including
  2442. searches, seeks, hits, current record number, current key, key node contents,
  2443. key node pointers, stack state, key and record counts, and other info.
  2444. By using the HereSeg value returned from StatKXB you can locate the searches,
  2445. seeks, and hits data at (DEF SEG=HereSeg: Seeks&=GetLongAt&(517): DEF SEG)
  2446.  +513 Searches AS LONG ;keys searched for since open
  2447.  +517 Seeks AS LONG    ;nodes seeked since open
  2448.  +521 Hits AS LONG     ;seeks satisfied without disk access
  2449. See: ExitPack
  2450. ~ExitPack
  2451.  Src: InitXBsrc        Func: ExitXB, AtExitXB
  2452. TYPE ExitPack              'EP
  2453. Func AS INTEGER            '1=ExitXB, 2=AtExitXB
  2454. Stat AS INTEGER            'ret:completion status
  2455. END TYPE '4 bytes
  2456. See: FieldDescTYPE
  2457. ~FieldDescTYPE
  2458.  Src: CreateDXBsrc     Func: CreateDXB
  2459. TYPE FieldDescTYPE         'this TYPE is used by CreateDataPack ONLY
  2460. FieldName AS STRING * 11   'zero-filled field name (use only ASCII 65-90,95)
  2461. FieldType AS STRING * 1    'C-har,N-umeric,D-ate,L-ogical,M-emo
  2462. FieldDA AS LONG            '=0,reserved
  2463. FieldLength AS STRING * 1  'C=1-254,N=1-19(varies),D=8,L=1,M=10
  2464. FieldDC AS STRING * 1      'decimal places for FieldType=N (0,2-15)
  2465. A1 AS INTEGER              '=0,reserved
  2466. A2 AS INTEGER              '=0,reserved
  2467. filler AS STRING * 10      '=0,reserved
  2468. END TYPE '32
  2469. If you can can forgo dBASE compatility you can use the B field type. This type
  2470. is for fields that contain binary data (all dBASE fields contain ASCII text or
  2471. numeric strings). If you specify a FieldType = "B" for, say an integer field,
  2472. use a FieldLen = 2. If the field is a long integer, use FieldLen = 4. You can
  2473. also use this non-standard field type for indexing. See CreateKXB for more.
  2474. See: HandlePack  CreateDataPack  CreateKXB
  2475. ~HandlePack
  2476.  Src: CloseDXBsrc      Func: CloseDXB, ReadDHXB, FlushDHXB, ZapDHXB
  2477.                              CloseKXB, ReadKHXB, FlushKHXB, ZapKHXB
  2478.                            'HP
  2479. TYPE HandlePack            '12=CloseDXB,14=ReadDHXB,15=FlushDHXB,17=ZapDHXB
  2480. Func AS INTEGER            '22=CloseDXB,24=ReadDHXB,25=FlushDHXB,27=ZapDHXB
  2481. Stat AS INTEGER            'ret:completion status
  2482. Handle AS INTEGER          'handle of BULLET file
  2483. END TYPE '6
  2484. See: InitPack
  2485. ~InitPack
  2486.  Src: InitXBsrc        Func: InitXB
  2487. TYPE InitPack              'IP
  2488. Func AS INTEGER            '0
  2489. Stat AS INTEGER            'ret:completion status
  2490. JFTmode AS INTEGER         'expand JFT if non-zero
  2491. DOSver AS INTEGER          'ret:DOS version
  2492. Version AS INTEGER         'ret:BULLET version * 100
  2493. ExitOff AS INTEGER         'ret:far pointer to ExitXB routine, offset
  2494. ExitSeg AS INTEGER         'ret:segment of ExitXB
  2495. END TYPE '12 bytes
  2496.      
  2497. See: MemoryPack
  2498. ~MemoryPack
  2499.  Src: MemoryXBsrc      Func: MemoryXB
  2500. TYPE MemoryPack            'MP
  2501. Func AS INTEGER            '3
  2502. Stat AS INTEGER            'ret:completion status
  2503. Memory AS LONG             'ret:largest free OS memory block
  2504. END TYPE '8 bytes
  2505. See: OpenPack
  2506. ~OpenPack
  2507.  Src: OpenDXBsrc       Func: OpenDXB, OpenKXB
  2508. TYPE OpenPack              'OP
  2509. Func AS INTEGER            '11=OpenDXB,21=OpenKXB
  2510. Stat AS INTEGER            'ret:completion status
  2511. Handle AS INTEGER          'ret:OS handle of file opened
  2512. FilenamePtrOff AS INTEGER  'far pointer to filenameZ to open
  2513. FilenamePtrSeg AS INTEGER  '(filename must end with a CHR$(0))
  2514. ASmode AS INTEGER          'DOS access-sharing mode (see OpenFileDOS)
  2515. XBlink AS INTEGER          'if opening key file this is its related XBlink
  2516. END TYPE '14               '(if opening data file xbLink is not used)
  2517. See: RemotePack  OpenFileDOS
  2518. ~RemotePack
  2519.  Src: DriveRemoteXBsrc  Func: DriveRemoteXB, FileRemoteXB
  2520. TYPE RemotePack            'RP
  2521. Func AS INTEGER            '86=DriveRemoteXB,87=FileRemoteXB
  2522. Stat AS INTEGER            'ret:completion status
  2523. Handle AS INTEGER          'handle/drive depending on routine
  2524. IsRemote AS INTEGER        '0=local,1=remote
  2525. Flags AS INTEGER           'dx register as returned by DOS
  2526. IsShare AS INTEGER         '0=SHARE.EXE not loaded
  2527. END TYPE '12
  2528. See: SetRetriesPack
  2529. ~SetRetriesPack
  2530.  Src: SetRetriesXBsrc  Func: SetRetriesXB
  2531. TYPE SetRetriesPack        'SRP
  2532. Func AS INTEGER            '88
  2533. Stat AS INTEGER            'ret:completion status
  2534. Mode AS INTEGER            '0=set DOS default else use Pauses/Retries below
  2535. Pause AS INTEGER           '0-65535 loop counter between retries
  2536. Retries As INTEGER         '0-65535 retries to access locked file
  2537. END TYPE '10
  2538. The default values for Retries is 3 and Pause is 1.
  2539. The Pause value is used as a simple loop counter used to waste time. This loop
  2540. IS dependent on CPU power so values are not portable across different machines.
  2541. Do not use unrealistic values. For example, don't set Retries to 30,000 unless
  2542. you really want to wait for DOS to try 30,000 times before returning an error!
  2543. See: StatDataPack
  2544. ~StatDataPack
  2545.  Src: StatDXBsrc       Func: StatDXB
  2546. TYPE StatDataPackTYPE      'SDP
  2547. Func AS INTEGER            '13
  2548. Stat AS INTEGER            'ret:completion status
  2549. Handle AS INTEGER          'BULLET data file to get status on
  2550. FileType AS STRING * 1     'ret:1=BULLET XB data file
  2551. Dirty AS STRING * 1        'ret:0=not changed
  2552. Recs AS LONG               'ret:records in file
  2553. RecLen AS INTEGER          'ret:record length
  2554. Fields AS INTEGER          'ret:fields per record ()
  2555. f1 AS STRING * 1           'reserved (1=update DVmon)
  2556. LUyear AS STRING * 1       'ret:binary, year file last updated
  2557. LUmonth AS STRING * 1      'ret:month   --LUs are 0 if DBF newly created
  2558. LUday AS STRING * 1        'ret:day
  2559. HereSeg AS INTEGER         'ret:this file's control segment
  2560. filler AS STRING * 10      'reserved
  2561. END TYPE '32
  2562. See: StatKeyPack
  2563. ~StatKeyPack
  2564.  Src: StatKXBsrc       Func: StatKXB
  2565. TYPE StatKeyPack           'SKP
  2566. Func AS INTEGER            '23
  2567. Stat AS INTEGER            'ret:completion status
  2568. Handle AS INTEGER          'BULLET key file to get status on
  2569. FileType AS STRING * 1     'ret:0=BULLET XB key file
  2570. Dirty AS STRING * 1        'ret:0=not changed
  2571. Keys AS LONG               'ret:keys in file
  2572. KeyLen AS INTEGER          'ret:key length
  2573. XBlink AS INTEGER          'ret:related BULLET XB data file handle
  2574. XBrecno AS LONG            'ret:record number attached to current key
  2575. HereSeg AS INTEGER         'ret:this file's control segment
  2576. CodePageID AS INTEGER      'ret:code page ID number of key file sort
  2577. CountryCode AS INTEGER     'ret:country code number of key file sort
  2578. CollateTableSize AS INTEGER 'ret: size of collate table, 0 or 256
  2579. KeyFlags AS INTEGER        'ret:bit 0=unique,1=char,4=int,5=long,E=NLS,F=signed
  2580. filler AS STRING * 2
  2581. END TYPE '32
  2582. See: StatHandlePack
  2583. ~StatHandlePack
  2584.  Src: StatHandleXBsrc  Func: StatHandleXB
  2585. TYPE StatHandlePack        'SHP
  2586. Func AS INTEGER            '6
  2587. Stat AS INTEGER            'ret:completion status
  2588. Handle AS INTEGER          'file handle to get information on
  2589. ID AS INTEGER              '0=XB key file,1=XB data file,-1=not a BULLET handle
  2590. END TYPE '8 bytes
  2591. See: XErrorPack
  2592. ~XErrorPack
  2593.  Src: GetExtErrorXBsrc Func: GetExtErrorXB
  2594. TYPE XErrorPack            'XEP
  2595. Func AS INTEGER            '7
  2596. Stat AS INTEGER            'ret:extended error
  2597. Class AS INTEGER           'ret:error class
  2598. Action AS INTEGER          'ret:suggested action
  2599. Location AS INTEGER        'ret:error location
  2600. END TYPE '10 bytes
  2601. See: AccessPack  Errors_DOS
  2602. ~Errors_BULLET    (200-209)
  2603. 200 key not found - The search key for Equal was not matched exactly.
  2604.     Next/Prev routines can be used to continue search from point of mismatch.
  2605. 201 key already exists - Attempted to add a key that already exists in the
  2606.     index file created to allow only unique keys.
  2607. 202 end of file - A Next routine is past the last key of the index file.
  2608. 203 top of file - A Prev routine is before the first key of the index file.
  2609. 204 key file empty - A key access was attempted with no keys in the index file.
  2610. 205 key type unknown - Generally indicates a corrupt index header (keyflags
  2611.     unknown at key insert).
  2612.     reserved,206-207
  2613. 208 no more nodes - The index file has reached full capacity (32MB). ReindexXB
  2614.     can often shrink an index file by 30 to 50%.
  2615. 209 key file corrupt - The index file is corrupt (write attempt to node 0).
  2616. See: Errors_BULLET_b
  2617. ~Errors_BULLET_b  (210-233)
  2618. 210 key file corrupt - The index file is corrupt (internal overflow).
  2619.     reserved,211-219
  2620. 220 incorrect DOS version - BULLET requires DOS 3.3 or later.
  2621. 221 invalid key length - The key is > 62 bytes (or 64 if unique specified).
  2622. 222 file not open - The specified handle is not an open BULLET file.
  2623.        
  2624. 223 invalid record number - The specified record number is < 0, past the last
  2625.     record number in the .DBF, or is > 16,777,215.
  2626.     reserved,224-227
  2627. 228 invalid filetype - The specified handle is not the correct type for the
  2628.     operation (i.e., specifying a data file handle for a key file operation).
  2629.     reserved,229-232
  2630. 233 init not active - InitXB must be called before all others except MemoryXB.
  2631. See: Errors_BULLET_c
  2632. ~Errors_BULLET_c  (234-249)
  2633. 234 init already active - InitXB has already been called. Use ExitXB first to
  2634.     call InitXB more than once per process. (Make sure the xxP.Func <> 0.)
  2635. 235 too many indexes - BULLET can handle up to 32 index files per transaction
  2636.     record with the InsertXB and UpdateXB routines. Contact the author if you
  2637.     need to allow for more than 32 index files/transaction record.
  2638.     reserved,236-239
  2639. 240 invalid key expression - The CreateKXB key expression could not be
  2640.     evaluated.
  2641.     reserved,241
  2642. 242 field not found - The fieldname was not found in the descriptor area.
  2643. 243 invalid field count - Too many fields were specified or the specified field
  2644.     number is past the last field.
  2645.     reserved,244-249
  2646. See: Errors_BULLET_d
  2647. ~Errors_BULLET_d  (250-255)
  2648. 250 invalid country info - The specifed country code or code page ID is not
  2649.     valid or not installed (according to DOS).
  2650. 251 invalid collate table size - The specified country code/code page ID uses
  2651.     a collate-sequence table > 256 bytes (2-byte characters as with Kanji).
  2652. 252 invalid keyflags - The specified keyflags are invalid.
  2653.     reserved,253-254
  2654. 255 evaluation mode shutdown - BULLET evaluation period has completed.
  2655.     You can reinstall to continue evaluation, though you may want to consider
  2656.     your motives for reinstalling since the original evaluation period has
  2657.     expired. This error occurs only after the evaluation period has expired.
  2658.     It is not recommended that you continue to use BULLET after the evaluation
  2659.     period. It is possible for no 255 error to be generated for quite some
  2660.     time since it occurs only under certain load conditions and then only when
  2661.     certain routine sequences are performed. The specified evaluation period of
  2662.     21 days should be adhered to.
  2663. See: Errors_BASIC
  2664. ~Errors_BASIC
  2665.  1 NEXT without FOR                    24 device timeout
  2666.  2 syntax error                        25 device fault
  2667.  3 RETURN without GOSUB                26 FOR without NEXT
  2668.  4 out of DATA                         27 out of paper
  2669.  5 illegal function call               29 WHILE without WEND
  2670.  6 overflow                            30 WEND without WHILE
  2671.  7 out of memory                          reserved,31-32
  2672.  8 label not defined                   33 duplicate label
  2673.  9 subscript out of range                 reserved,34
  2674. 10 duplicate definition                35 subprogram not defined
  2675. 11 division by zero                       reserved,36
  2676. 12 illegal in direct mode              37 argument-count mismatch
  2677. 13 type mismatch                       38 array not defined
  2678. 14 out of string space                    reserved,39
  2679.    reserved,15                         40 variable required
  2680. 16 string formula too complex             reserved,41-49
  2681. 17 cannot continue                     50 FIELD overflow
  2682. 18 function not defined                51 internal error
  2683. 19 no RESUME                           52 bad file name or number
  2684. 20 RESUME without error                53 file not found
  2685.    reserved,21-23                      54 bad file mode
  2686. See: Errors_BASIC_b
  2687. ~Errors_BASIC_b
  2688. 55 file already open                      reserved,77-79
  2689. 56 FIELD statement active              80 feature removed
  2690. 57 device I/O error                    81 invalid name
  2691. 58 file already exists                 82 table not found
  2692. 59 bad record length                   83 index not found
  2693.    reserved,60                         84 invalid column
  2694. 61 disk full                           85 no current record
  2695. 62 input past end of file              86 duplicate value for unique index
  2696. 63 bad record number                   87 invalid operation on null index
  2697. 64 bad file name                       88 database needs repair
  2698.    reserved,65-66                      89 insufficient ISAM buffers
  2699. 67 too many files
  2700. 68 device unavailable
  2701. 69 communication-buffer overflow
  2702. 70 permission denied
  2703. 71 disk not ready
  2704. 72 disk-media error
  2705. 73 feature unavailable
  2706. 74 rename across disks
  2707. 75 path/File access error
  2708. 76 path not found
  2709. See: Errors_DOS
  2710. ~Errors_DOS
  2711. -2 disk full or unexpected end of file
  2712. -1 bad filename
  2713.  0 no error
  2714.  1 function not supported              19 disk write protected
  2715.  2 file not found                      20 unknown unit
  2716.  3 path not found                      21 drive not ready
  2717.  4 too many open files                 22 unknown command
  2718.  5 access denied (see Specs_Networks)  23 data error (CRC)
  2719.  6 handle invalid                      24 bad request structure length
  2720.  7 MCBs destroyed                      25 seek error
  2721.  8 not enough memory                   26 unknown medium type
  2722.  9 memory block address invalid        27 sector not found
  2723. 10 environment invalid                 28 printer out of paper
  2724. 11 format invalid                      29 write fault
  2725. 12 access code invalid                 30 read fault
  2726. 13 data invalid                        31 general failure
  2727.    reserved-0Eh                        32 sharing violation
  2728. 15 disk drive invalid                  33 lock violation
  2729. 16 cannot remove current directory     34 disk change invalid/wrong disk
  2730. 17 not same device                     35 FCB unavailable
  2731. 18 no more files                       36 sharing buffer overflow
  2732. See: Errors_DOS_b
  2733. ~Errors_DOS_b
  2734. 37 code page mismatched                58 incorrect response from network
  2735. 38 handle EOF                          59 unexpected network error
  2736. 39 handle disk full                    60 incompatible remote adapter
  2737.    reserved-28h                        61 print queue full
  2738.    reserved-29h                        62 no spool space
  2739.    reserved-2Ah                        63 not enough space to print file
  2740.    reserved-2Bh                        64 network name deleted
  2741.    reserved-2Ch                        65 network access denied
  2742.    reserved-2Dh                        66 network device type incorrect
  2743.    reserved-2Eh                        67 network name not found
  2744.    reserved-2Fh                        68 network name limit exceeded
  2745.    reserved-30h                        69 NETBIOS session limit exceeded
  2746.    reserved-31h                        70 sharing temporarily paused
  2747. 50 network request not supported       71 network request not accepted
  2748. 51 remote computer not listening       72 print/disk redirection paused
  2749. 52 duplicate name on network              reserved-49h
  2750. 53 network pathname not found             reserved-4Ah
  2751. 54 network busy                           reserved-4Bh
  2752. 55 network device no longer exists        reserved-4Ch
  2753. 56 NETBIOS command limit exceeded         reserved-4Dh
  2754. 57 network adapter hardware error         reserved-4Eh
  2755. See: Errors_DOS_c
  2756. ~Errors_DOS_c
  2757.    reserved-4Fh                  
  2758.  DOS Class Codes 
  2759. 80 file exists
  2760. 81 duplicate FCB                 1 out of resources       7 application error
  2761. 82 cannot make                   2 temporary situation    8 not found
  2762. 83 fail on INT24                 3 authorization          9 bad format
  2763. 84 out of structures             4 internal error        10 locked
  2764. 85 already assigned              5 hardware failure      11 media failure
  2765. 86 invalid password              6 system failure        12 already exists
  2766. 87 invalid parameter                                     13 unknown
  2767. 88 network write fault
  2768.    reserved-59h                    DOS Action Codes         DOS Locus Codes
  2769. 90 sys comp not loaded
  2770.                                  1 retry immediately      1 unknown
  2771.                                  2 delay and retry        2 block device
  2772.                                  3 reenter input          3 network
  2773.                                  4 abort ASAP             4 serial device
  2774.                                  5 abort immediately      5 memory
  2775.                                  6 ignore error
  2776.                                  7 user intervention
  2777. See: Errors_BULLET
  2778. ~InitXBsrc
  2779. Func: InitXB           Pack: InitPack           Func:   0/System
  2780. DIM IP AS InitPack
  2781. DIM EP AS ExitPack
  2782. IP.Func = InitXB        'InitXB defined in BULLET.BI
  2783. IP.JFTmode = 1          'expand JFT to 255 handles
  2784. stat = BULLET(IP)
  2785. IF stat = 0 THEN
  2786.    DOSmajor = IP.DOSver\256
  2787.    DOSminor = IP.DOSver MOD 256
  2788.    BULLETver = IP.Version
  2789.    SegExitXB = IP.ExitSeg
  2790.    OffExitXB = IP.ExitOff
  2791.    EP.Func = AtExitXB   'register ExitXB with _atexit shutdown routine
  2792.    stat = BULLET(EP)
  2793. ENDIF
  2794. IF stat THEN 'error
  2795. See: ExitXBsrc
  2796. ~ExitXBsrc
  2797. Func: ExitXB           Pack: ExitPack           Func:   1/System
  2798. DIM EP AS ExitPack
  2799. EP.Func = ExitXB        'ExitXB defined in BULLET.BI
  2800. stat = BULLET(EP)
  2801. The return value from ExitXB is currently always 0.
  2802. See: AtExitXBsrc
  2803. ~AtExitXBsrc
  2804. Func: AtExitXB         Pack: ExitPack           Func:   2/System
  2805. DIM IP AS InitPack
  2806. DIM EP AS ExitPack
  2807. IP.Func = InitXB
  2808. IP.JFTmode = 1
  2809. stat = BULLET(IP)
  2810. IF stat = 0 THEN
  2811.    DOSmajor = IP.DOSver\256
  2812.    DOSminor = IP.DOSver MOD 256
  2813.    SegExitXB = IP.ExitSeg
  2814.    OffExitXB = IP.ExitOff
  2815.                         'register ExitXB with _atexit shutdown routine
  2816.    EP.Func = AtExitXB   'AtExitXB defined in BULLET.BI
  2817.    stat = BULLET(EP)    'the return value is that returned from the compiler
  2818.                         '_atexit routine, 0=okay, anything else is an error
  2819. ENDIF                   'indicating, for example, the _atexit register is full
  2820. IF stat THEN 'error
  2821. See: MemoryXBsrc
  2822. ~MemoryXBsrc
  2823. Func: MemoryXB         Pack: MemoryPack         Func:   3/System
  2824. DIM MP AS MemoryPack
  2825. WorkSpace& = 50000      'a value at least 40K or so
  2826. MemoryNeeded& = WorkSpace& + (144& * TotalDataFiles) + (1264& * TotalKeyFiles)
  2827. MP.Func = MemoryXB
  2828. stat = BULLET(MP)
  2829. IF MP.Memory < MemoryNeeded& THEN
  2830.     QBheap& = SETMEM(-MemoryNeeded& + 4096)  'release what we need+QB fudge
  2831.     MP.Func = MemoryXB
  2832.     stat = BULLET(MP)
  2833.     IF MP.Memory < MemoryNeeded& THEN 'not enough memory
  2834. END IF
  2835. MP.Memory does not reflect memory available through DOS in the UMB area. It's
  2836. possible that all memory requests can be satisfied by UMB RAM. Consult a DOS 5+
  2837. programmer reference for more information on this (see DOS INT21/58 for more).
  2838. In the QuickBASIC/BASIC PDS environment do not call SETMEM(-x) more than once.
  2839. The above example calls SETMEM() when it needs to. Use it.
  2840. See: BreakXBsrc
  2841. ~BreakXBsrc
  2842. Func: BreakXB          Pack: BreakPack          Func:   4/System
  2843. DIM BP AS BreakPack
  2844. BP.Func = BreakXB       'BreakXB defined in BULLET.BI
  2845. BP.Mode = 0             'disable Ctrl-C/Ctrl-BREAK (do nothing on those keys)
  2846. stat = BULLET(BP)       'stat=0 always
  2847. If BreakXB is called multiple times with the same BP.mode each time, only the
  2848. first is acted on. You can set BP.mode = 1 to restore the default handlers
  2849. (those installed originally) and then again set BP.Mode = 0 to disable them.
  2850. ExitXB calls this routine automatically as part of the BULLET shutdown to
  2851. restore the original default break handlers.
  2852. See: BackupFileXBsrc
  2853. ~BackupFileXBsrc
  2854. Func: BackupFileXB     Pack: CopyPack           Func:   5/System
  2855. DIM AP AS AccessPack
  2856. DIM CP AS CopyPack
  2857. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  2858.                                 'so same source QB AND BASIC7 /Fs compatible
  2859. TempStr = NewFilename$          'assign the var-len string to fixed-len str
  2860. CP.Func = BackupFileXB  'defined in BULLET.BI
  2861. CP.Handle = DataHandle  'handle of data file to backup
  2862. CP.FilenamePtrOff = VARPTR(TempStr) 'ALWAYS use VARPTR() on fixed-len string
  2863. CP.FilenamePtrSeg = VARSEG(TempStr) 'ALWAYS use VARSEG() on fixed-len string
  2864. stat = BULLET(CP)       'copy the data file to the file NewFilename$
  2865. IF stat = 0 THEN
  2866.    AP.Func = PackRecordsXB
  2867.    AP.Handle = DataHandle
  2868.    stat = BULLET(AP)
  2869. ENDIF
  2870. IF stat THEN 'error
  2871. See: StatHandleXBsrc
  2872. ~StatHandleXBsrc
  2873. Func: StatHandleXB     Pack: StatHandlePack     Func:   6/System
  2874. DIM SHP AS StatHandlePack
  2875. DIM SKP AS StatKeyPack
  2876. DIM SDP AS StatDataPack
  2877. SHP.Func = StatHandleXB 'defined in BULLET.BI
  2878. SHP.Handle = TheHandleNumber
  2879. stat = BULLET(SHP)
  2880. IF SHP.ID = 0 THEN      'handle belongs to an index file (index file/key file)
  2881.    SKP.Func = StatKXB   'get key stats  -- see StatKXB/StatDXB for more
  2882.    SKP.Handle = PassedHandleNumber      ' on the SKP structure
  2883.    stat = BULLET(SKP)
  2884. ELSEIF SHP.ID = 1 THEN  '.DBF data file
  2885.    'get DBF stats
  2886.    'error not a BULLET file type
  2887. ENDIF
  2888. See: GetExtErrorXBsrc
  2889. ~GetExtErrorXBsrc
  2890. Func: GetExtErrorXB    Pack: XErrorPack         Func:   7/System
  2891. 'an error just occured in the range 1 to 199 as returned in one of the
  2892. 'pack.Stat variables (current max DOS error is 90 (5Ah))
  2893. 'remember, transaction-based routines return a bad pack index in the return
  2894. 'stat value, which you use to check the appropriate pack.Stat variable
  2895. DIM XEP AS XErrorPack
  2896. XEP.Func = GetExtErrorXB 'defined in BULLET.BI
  2897. stat = BULLET(XEP)
  2898. IF stat <> 0 THEN
  2899.    PRINT "Extended Codes --"
  2900.    PRINT "            error: "; XEP.Stat
  2901.    PRINT "      error class: "; XEP.Class
  2902.    PRINT "recommened action: "; XEP.Action
  2903.    PRINT "         location: "; XEP.Location
  2904.    PRINT "No error"
  2905. ENDIF
  2906. See: DVmonCXBsrc  StatKXB
  2907. ~DVmonCXBsrc
  2908. Func: DVmonCXB         Pack: DVmonPack          Func:   9/DEBUG
  2909. 'at this point a data file and a key file have been opened
  2910. 'kf is that key file's DOS handle
  2911. DIM DV AS DVmonPack
  2912. DV.Func = DVmonCXB      'defined in BULLET.BI
  2913. DV.Mode = 1             'enable monitoring
  2914. DV.Handle = kf          'monitor key file handle, kf (and its XBlink data file)
  2915. DV.VideoSeg = &HB800+(4096\16)  'output to color screen, page 1 (pages 0 to ?)
  2916. stat = BULLET(DV)       'stat=0 always even if not DEBUG ENGINE
  2917. For two-monitor systems (with a color monitor as the main system) output should
  2918. be directed to &HB000, the mono monitor's video memory.
  2919. DVmonCXB stands for Dual Video Monitor Control XB.
  2920. See: CreateDXBsrc
  2921. ~CreateDXBsrc
  2922. Func: CreateDXB        Pack: CreateDataPack     Func:  10/Mid-level
  2923. DIM CDP AS CreateDataPack
  2924. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  2925. REDIM FD(1 TO 2) AS FieldDescTYPE 'field descriptions for each of the fields...
  2926.                                   '...in the record (record has 2 fields)
  2927. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string...
  2928.                                 '...so we can use VARSEG/VARPTR
  2929. 'build FD first for each of the fields in the record
  2930. FD(1).FieldName = "STUDENT" + STRING$(10,0)   'must be zero-filled
  2931. FD(1).FieldType = "C"           'a character field type
  2932. FD(1).FieldLength = CHR$(20)    'up to 20 characters (a byte field--use CHR$())
  2933. FD(1).FieldDC = CHR$(0)         'non-numeric has no decimal places
  2934. FD(2).FieldName = "SCORE" + STRING$(10,0)
  2935. FD(2).FieldType = "N"
  2936. FD(2).FieldLength = CHR$(3)     'dBASE numeric format, allow for "100"
  2937. FD(2).FieldDC = CHR(0)          'no decimal places used for this field
  2938. '(cont)
  2939.                      'for BINARY FieldType="B" see FieldDescTYPE
  2940. See: CreateDXBsrc_a                                                     -MORE-
  2941. ~CreateDXBsrc_a
  2942. 'build the CDP
  2943. CDP.Func = CreateDXB            'defined in BULLET.BI
  2944. CDP.FilenamePtrOff = VARPTR(TempStr) 'point to filenameZ (Z=0-terminated str)
  2945. CDP.FilenamePtrSeg = VARSEG(TempStr)
  2946. CDP.NoFields = 2                'this example has 2 fields
  2947. CDP.FieldListPtrOff = VARPTR(FD(1)) 'point to the first field decription...
  2948. CDP.FieldListPtrSeg = VARPTR(FD(1)) '...defined in the previous screen
  2949. CDP.FileID = 3                  'standard dBASE file ID
  2950. stat = BULLET(CDP)              'create the DBF data file
  2951. IF stat THEN 'error
  2952. Normally this code would be written as a generalized FUNCTION. The CDP could be
  2953. a global allocation (DIM SHARED CDP AS CreateDataPack) and the FD() would also
  2954. be (REDIM [SHARED] FD(1 TO 1) AS FieldDescTYPE) and REDIM'd to needed size when
  2955. used. A possible header:
  2956.  DECLARE FUNCTION CreateDBF% (filename$, NoFields%, FD() AS FieldDescTYPE)
  2957. To create a DBF you'd need just the filename, number of fields, REDIM the FD()
  2958. array (if needed), fill in FD() array, then call the function. Look at the
  2959. source code examples on the distribution disk for more.
  2960. See: OpenDXBsrc  CreateDXBsrc
  2961. ~OpenDXBsrc
  2962. Func: OpenDXB          Pack: OpenPack           Func:  11/Mid-level
  2963. DIM OP AS OpenPack
  2964. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  2965. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string...
  2966. OP.Func = OpenDXB                   'defined in BULLET.BI
  2967. OP.FilenamePtrOff = VARPTR(TempStr) 'point to filenameZ (Z=0-terminated str)
  2968. OP.FilenamePtrSeg = VARSEG(TempStr)
  2969. OP.ASmode = ReadWrite + DenyNone    'defined in BULLET.BI
  2970. stat = BULLET(OP)
  2971. IF stat THEN 'error
  2972. The ASmode (access/sharing mode) determines how the operating system controls
  2973. access to the file. See OpenFileDOS for the meanings of the various ASmodes.
  2974. See: CloseDXBsrc  OpenFileDOS
  2975. ~CloseDXBsrc
  2976. Func: CloseDXB         Pack: HandlePack         Func:  12/Mid-level
  2977. DIM HP AS HandlePack
  2978. HP.Func = CloseDXB              'defined in BULLET.BI
  2979. HP.Handle = datahandle          'handle of the file to close
  2980. stat = BULLET(HP)
  2981. IF stat THEN 'error
  2982. See: StatDXBsrc
  2983. ~StatDXBsrc
  2984. Func: StatDXB          Pack: StatDataPack       Func:  13/Mid-level
  2985. DIM SDP AS StatDataPack
  2986. SDP.Func = StatDXB          'defined in BULLET.BI
  2987. SDP.Handle = datahandle     'data handle to get stats on
  2988. stat = BULLET(SDP)          'must be a data handle, use StatHandleXB if you...
  2989. IF stat = 0 THEN            '...don't know the type of file a handle's for
  2990.    'SDP.FileType is set to 1
  2991.    'SDP.Dirty is set to 1 if the file has changed (0=not changed)
  2992.    'SDP.Recs = number of records in the DBF file
  2993.    'SDP.RecLen = record length
  2994.    'SDP.Fields = number of fields in the record
  2995.    'SDP.f1 is reserved
  2996.    'SDP.LUyear = year file last updated, binary (year = ASC(SDP.LUyear))
  2997.    'SDP.LUmonth = month, binary
  2998.    'SDP.LUday = day, binary
  2999.    'SDP.HereSeg is set to this handle's control segment (location in memory)
  3000.    'error
  3001. ENDIF
  3002. See: ReadDHXBsrc
  3003. ~ReadDHXBsrc
  3004. Func: ReadDHXB         Pack: HandlePack         Func:  14/Mid-level
  3005. DIM HP AS HandlePack
  3006. HP.Func = ReadDHXB              'defined in BULLET.BI
  3007. HP.Handle = datahandle          'handle of file whose header you want to reload
  3008. stat = BULLET(HP)
  3009. IF stat THEN 'error
  3010. This routine is automatically called by the network lock routines.
  3011. See: FlushDHXBsrc  LockDataXB
  3012. ~FlushDHXBsrc
  3013. Func: FlushDHXB        Pack: HandlePack         Func:  15/Mid-level
  3014. DIM HP AS HandlePack
  3015. HP.Func = FlushDHXB             'defined in BULLET.BI
  3016. HP.Handle = datahandle          'handle of file you want to flush
  3017. stat = BULLET(HP)
  3018. IF stat THEN 'error
  3019. Note that the physical write to disk is performed only if the file has changed
  3020. since the open or last flush.
  3021. This routine is automatically called by the network unlock routines.
  3022. See: CopyDHXBsrc  UnlockDataXB
  3023. ~CopyDHXBsrc
  3024. Func: CopyDHXBsrc      Pack: CopyPack           Func:  16/Mid-level
  3025. DIM CP AS CopyPack
  3026. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  3027. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string...
  3028. CP.Func = CopyDHXB              'defined in BULLET.BI
  3029. CP.Handle = datahandle          'handle of file to copy from (the source)
  3030. CP.FilenamePtrOff = VARPTR(TempStr) 'far pointer to filenameZ for copy
  3031. CP.FilenamePtrSeg = VARPTR(TempStr) '(the destination)
  3032. stat = BULLET(CP)
  3033. IF stat THEN 'error
  3034. See: ZapDHXBsrc
  3035. ~ZapDHXBsrc
  3036. Func: ZapDHXB          Pack: HandlePack         Func:  17/Mid-level
  3037. DIM HP AS HandlePack
  3038. HP.Func = ZapDHXB               'defined in BULLET.BI
  3039. HP.Handle = datahandle          'handle of file you want !ZAP!
  3040. stat = BULLET(HP)
  3041. IF stat THEN 'error
  3042. Note that this removes ALL data records from the data file.
  3043. See: CreateKXBsrc
  3044. ~CreateKXBsrc
  3045. Func: CreateKXB        Pack: CreateKeyPack      Func:  20/Mid-level
  3046. 'This code assumes that the datafile was created as in CreateDXBsrc, and that
  3047. 'the datafile was opened as in OpenDXBsrc.
  3048. kx$ = "SUBSTR(STUDENT,1,5)"     'key expression, a non-unique, character key
  3049. DIM CKP AS CreateKeyPack
  3050. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  3051. DIM TempStr2 AS STRING * 136    'used as fixed-length string for VARPTR()
  3052. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string
  3053. TempStr2 = kx$ + CHR$(0)        'same for key expression string
  3054. '(cont)
  3055. See: CreateKXBsrc_a                                                     -MORE-
  3056. ~CreateKXBsrc_a
  3057. CKP.Func = CreateKXB                 'defined in BULLET.BI
  3058. CKP.FilenamePtrOff = VARPTR(TempStr) 'far pointer to filenameZ
  3059. CKP.FilenamePtrSeg = VARSEG(TempStr)
  3060. CKP.KeyExpPtrOff = VARPTR(TempStr2)  'far pointer to key expressionZ
  3061. CKP.KeyExpPtrSeg = VARSEG(TempStr2)
  3062. CKP.XBlink = datahandle              'the datafile handle returned from OpenDXB
  3063. CKP.KeyFlags = cCHAR                 '-KEYFLAGS- are defined in BULLET.BI
  3064. CKP.CodePageID = -1                  'use DOS default code page ID
  3065. CKP.CountryCode = -1                 'use DOS default country code
  3066. CKP.CollatePtrOff = 0                'no user-supplied collate table...
  3067. CKP.CollatePtrSeg = 0                '...
  3068. stat = BULLET(CKP)
  3069. IF stat THEN 'error
  3070. Normally this code would be written as a generalized FUNCTION. The CKP could be
  3071. a global allocation (DIM SHARED CKP AS CreateKeyPack). A possible header:
  3072.  DECLARE FUNCTION CreateNewIndex% (filename$, datahandle, kx$, KeyFlags%)
  3073. To create an index file you'd need just filename, datahandle, key expression,
  3074. and key flags (country code info if not using default), then call the function.
  3075. See: OpenKXBsrc  CreateKXBsrc
  3076. ~OpenKXBsrc
  3077. Func: OpenKXB          Pack: OpenPack           Func:  21/Mid-level
  3078. DIM OP AS OpenPack
  3079. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  3080. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string...
  3081. OP.Func = OpenKXB                   'defined in BULLET.BI
  3082. OP.FilenamePtrOff = VARPTR(TempStr) 'point to filenameZ (Z=0-terminated str)
  3083. OP.FilenamePtrSeg = VARSEG(TempStr)
  3084. OP.ASmode = ReadWrite + DenyNone    'defined in BULLET.BI
  3085. OP.XBlink = datafilehandle          'OpenKXB needs to know the data file handle
  3086. stat = BULLET(OP)
  3087. IF stat THEN 'error
  3088. The ASmode (access/sharing mode) determines how the operating system controls
  3089. access to the file. See OpenFileDOS for the meanings of the various ASmodes.
  3090. Before you can open an index file you must first open its associated data file.
  3091. See: CloseKXBsrc  OpenFileDOS
  3092. ~CloseKXBsrc
  3093. Func: CloseKXB         Pack: HandlePack         Func:  22/Mid-level
  3094. DIM HP AS HandlePack
  3095. HP.Func = CloseDXB              'defined in BULLET.BI
  3096. HP.Handle = indexhandle         'handle of the file to close
  3097. stat = BULLET(HP)
  3098. IF stat THEN 'error
  3099. See: StatKXBsrc
  3100. ~StatKXBsrc
  3101. Func: StatKXB          Pack: StatKeyPack        Func:  23/Mid-level
  3102. DIM SKP AS StatKeyPack
  3103. SKP.Func = StatKXB          'defined in BULLET.BI
  3104. SKP.Handle = indexhandle    'handle to get stats on
  3105. stat = BULLET(SKP)          'must be index handle, use StatHandleXB if you...
  3106. IF stat = 0 THEN            '...don't know the type of file a handle's for
  3107.    'SKP.FileType is set to 0
  3108.    'SKP.Dirty is set to 1 if the file has changed (0=not changed)
  3109.    'SKP.Keys = number of key in the index file (index file=key file)
  3110.    'SKP.KeyLen = physical key length (1-64 bytes)
  3111.    'SKP.XBlink = datafile handle that this index file is associated with
  3112.    'SKP.XBrecno is set to record number associated with last accessed key
  3113.    'SKP.HereSeg is set to this handle's control segment (location in memory)
  3114.    'SKP.CodePageID returns this index file's permanent code page ID
  3115.    'SKP.CountryCode returns this index file's permanent country code
  3116.    'SKP.CollateTableSize = 0 (no collate table present) or 256 (table present)
  3117.    'SKP.KeyFlags = key flags specifed at CreateKXB (except NLS flag may be set)
  3118. ELSE                                               (NLS flag is bit 14, &H4000)
  3119.    'error
  3120. See: ReadKHXBsrc
  3121. ~ReadKHXBsrc
  3122. Func: ReadKHXB         Pack: HandlePack         Func:  24/Mid-level
  3123. DIM HP AS HandlePack
  3124. HP.Func = ReadDHXB              'defined in BULLET.BI
  3125. HP.Handle = indexhandle         'handle of file whose header you want to reload
  3126. stat = BULLET(HP)
  3127. IF stat THEN 'error
  3128. This routine is automatically called by the network lock routines.
  3129. See: FlushKHXBsrc  LockKeyXB
  3130. ~FlushKHXBsrc
  3131. Func: FlushKHXB        Pack: HandlePack         Func:  25/Mid-level
  3132. DIM HP AS HandlePack
  3133. HP.Func = FlushDHXB             'defined in BULLET.BI
  3134. HP.Handle = indexhandle         'handle of file you want to flush
  3135. stat = BULLET(HP)
  3136. IF stat THEN 'error
  3137. Note that the physical write to disk is performed only if the file has changed
  3138. since the open or last flush.
  3139. This routine is automatically called by the network unlock routines.
  3140. See: CopyKHXBsrc  UnlockKeyXB
  3141. ~CopyKHXBsrc
  3142. Func: CopyKHXBsrc      Pack: CopyPack           Func:  26/Mid-level
  3143. DIM CP AS CopyPack
  3144. DIM TempStr AS STRING * 80      'used as fixed-length string for VARPTR()
  3145. TempStr = filename$ + CHR$(0)   'assign filename to a fixed-len string...
  3146. CP.Func = CopyDHXB              'defined in BULLET.BI
  3147. CP.Handle = indexhandle         'handle of file to copy from (the source)
  3148. CP.FilenamePtrOff = VARPTR(TempStr) 'far pointer to filenameZ for copy
  3149. CP.FilenamePtrSeg = VARPTR(TempStr) '(the destination)
  3150. stat = BULLET(CP)
  3151. IF stat THEN 'error
  3152. See: ZapKHXBsrc
  3153. ~ZapKHXBsrc
  3154. Func: ZapKHXB          Pack: HandlePack         Func:  27/Mid-level
  3155. DIM HP AS HandlePack
  3156. HP.Func = ZapDHXB               'defined in BULLET.BI
  3157. HP.Handle = indexhandle         'handle of file you want !ZAP!
  3158. stat = BULLET(HP)
  3159. IF stat THEN 'error
  3160. Note that this removes ALL keys from the index file.
  3161. See: GetDescriptorXBsrc
  3162. ~GetDescriptorXBsrc
  3163. Func: GetDescriptorXB  Pack: DescriptorPack     Func:  30/Mid-level
  3164. DIM DP AS DescriptorPack
  3165. DP.Func = GetDescriptorXB               'defined in BULLET.BI
  3166. DP.Handle = datahandle                  'handle of file
  3167. IF FieldNumber > 0 THEN
  3168.    DP.FieldNumber = FieldNumber         'field number to get info on
  3169. ELSE                                    'or, if 0, then
  3170.    DP.FieldNumber = 0
  3171.    DP.FD.FieldName = fieldname$ + STRING$(10,0)   'fieldname$ to get info on
  3172. ENDIF
  3173. stat = BULLET(DP)
  3174. IF stat = 0 THEN
  3175.    'DP.FD.FieldName is set to field name
  3176.    'DP.FD.FieldType is set to field type
  3177.    'DP.FD.FieldLen is set to field length
  3178.    'DP.FD.FieldDC is set to field DC
  3179. ELSE         
  3180.    'error    
  3181. The DP.FD.FieldLen (and DP.FD.FieldDC) is a byte string so you 
  3182.              
  3183. need to use a FldLen=ASC(DP.FD.FieldLen) for its integer value 
  3184.              
  3185. See: GetRecordXBsrc
  3186. ~GetRecordXBsrc
  3187. Func: GetRecordXB      Pack: AccessPack         Func:  31/Mid-level
  3188. TYPE RecordTYPE                 'simple DBF record layout
  3189. tag AS STRING * 1  <
  3190. code AS STRING * 4     
  3191. THE FIRST BYTE OF YOUR RECORD TYPES MUST BE TAG! 
  3192. bday AS STRING * 8     
  3193. END TYPE
  3194. DIM RecBuff AS RecordTYPE       'record has 2 fields, code/C/4.0, bday/D/8.0
  3195. DIM AP AS AccessPack
  3196. AP.Func = GetRecordXB           'defined in BULLET.BI
  3197. AP.Handle = datahandle          'handle to get record from
  3198. AP.RecNo = RecnoToGet&          'record number to get
  3199. AP.RecPtrOff = VARPTR(RecBuff)  'read record from disk into RecBuff
  3200. AP.RecPtrSeg = VARSEG(RecBuff)
  3201. stat = BULLET(AP)
  3202. IF stat = 0 THEN
  3203.    PRINT RecBuff.code ; ", " ; RecBuff.bday     'sample output: 4321, 19331122
  3204.    'error
  3205. See: AddRecordXBsrc
  3206. ~AddRecordXBsrc
  3207. Func: AddRecordXB      Pack: AccessPack         Func:  32/Mid-level
  3208. TYPE RecordTYPE                 'simple DBF record layout
  3209. tag AS STRING * 1  <
  3210. code AS STRING * 4     
  3211. THE FIRST BYTE OF YOUR RECORD TYPES MUST BE TAG! 
  3212. bday AS STRING * 8     
  3213. END TYPE
  3214. DIM RecBuff AS RecordTYPE       'record has 2 fields, code/C/4.0, bday/D/8.0
  3215. DIM AP AS AccessPack
  3216. 'be sure to init the tag field to a space (ASCII 32)
  3217. RecBuff.tag = " " : RecBuff.code = "1234" : RecBuff.bday = "19331122"
  3218. AP.Func = AddRecordXB           'defined in BULLET.BI
  3219. AP.Handle = datahandle          'handle to add record to
  3220. AP.RecPtrOff = VARPTR(RecBuff)  'write record from RecBuff to disk...
  3221. AP.RecPtrSeg = VARSEG(RecBuff)  '...at next available record number
  3222. stat = BULLET(AP)
  3223. IF stat = 0 THEN
  3224.    PRINT "Record number used by AddRecordXB was "; AP.RecNo
  3225. ELSE 'error
  3226. See: UpdateRecordXBsrc
  3227. ~UpdateRecordXBsrc
  3228. Func: UpdateRecordXB   Pack: AccessPack         Func:  33/Mid-level
  3229. 'see GetRecordXBsrc for this source example's preliminary code
  3230. AP.Func = GetRecordXB           'first get the record to update
  3231. AP.Handle = datahandle
  3232. AP.RecNo = RecnoToGet&          '
  3233. AP.RecPtrOff = VARPTR(RecBuff)  '
  3234.  Do NOT use UpdateRecordXB to change   
  3235. AP.RecPtrSeg = VARSEG(RecBuff)  '
  3236.  any field(s) used in a key expression.
  3237. stat = BULLET(AP)               '
  3238.  Instead use UpdateXB.                 
  3239. IF stat = 0 THEN                '
  3240.    RecBuff.dbay = "19591122"    'change only non-key portions of record
  3241.    AP.Func = UpdateRecordXB     'defined in BULLET.BI
  3242.    stat = BULLET(AP)            'other AP. values are already set from the Get
  3243.    IF stat THEN                 'though you should reassign AP.RecPtrOff/Seg if
  3244.       'error                    'you perform any BASIC string functions between
  3245. 'BULLET calls (none were in this case).
  3246. NOTE: QB/PDS will move strings
  3247. '--by this I mean to set these again
  3248. after a user-break/Ctrl-Break 
  3249. '  AP.RecPtrOff = VARPTR(RecBuff)
  3250. in the QB/QBX environment !!! 
  3251. '  AP.RecPtrSeg = VARSEG(RecBuff)
  3252. '  stat = BULLET(AP) 'do the update call
  3253. See: DeleteRecordXBsrc  UpdateXB
  3254. ~DeleteRecordXBsrc
  3255. Func: DeleteRecordXB   Pack: AccessPack         Func:  34/Mid-level
  3256. DIM AP AS AccessPack
  3257. AP.Func = DeleteRecordXB        'defined in BULLET.BI
  3258. AP.Handle = datahandle          'handle of record to delete
  3259. AP.RecNo = RecnoToDelete&       'to determine which record number any record
  3260. stat = BULLET(AP)               'is, use one of the keyed access routines
  3261. IF stat THEN 'error
  3262. See: UndeleteRecordsrc (XB)
  3263. ~UndeleteRecordsrc (XB)
  3264. Func: UndeleteRecordXB Pack: AccessPack         Func:  35/Mid-level
  3265. DIM AP AS AccessPack
  3266. AP.Func = UndeleteRecordXB      'defined in BULLET.BI
  3267. AP.Handle = datahandle          'handle of record to undelete
  3268. AP.RecNo = RecnoToUndelete&     'to determine which record number any record
  3269. stat = BULLET(AP)               'is use one of the keyed access routines
  3270. IF stat THEN 'error
  3271. See: PackRecordsXBsrc
  3272. ~PackRecordsXBsrc
  3273. Func: PackRecordsXB    Pack: AccessPack         Func:  36/Mid-level
  3274. DIM AP AS AccessPack
  3275. AP.Func = PackRecordsXB         'defined in BULLET.BI
  3276. AP.Handle = datahandle          'handle of data file to pack
  3277. stat = BULLET(AP)
  3278. IF stat THEN 'error
  3279. See: FirstKeyXBsrc
  3280. ~FirstKeyXBsrc
  3281. Func: FirstKeyXB       Pack: AccessPack         Func:  40/Mid-level
  3282. DIM AP AS AccessPack
  3283. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3284.                                 'needs to be at least key length (MAXKEYLEN=64)
  3285. AP.Func = FirstKeyXB            'defined in BULLET.BI
  3286. AP.Handle = indexhandle         'handle to index file to access key from
  3287. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3288. AP.KeyPtrSeg = VARSEG(TempStr)  '(the first key is read from disk and put here)
  3289. stat = BULLET(AP)
  3290. IF stat = 0 THEN
  3291.    'TempStr is filled in with the key (for as many bytes as the key length)
  3292.    'so, if the key is a character type, you could PRINT LEFT$(TempStr,KeyLen)
  3293.    'or, if key is a 32-bit LONG then PRINT CVL(LEFT$(TempStr,4)). When using
  3294.    'the key returned, be aware that if UNIQUE was NOT specified then the
  3295.    'enumerator word is attached to the end of the key (the right two bytes).
  3296.    'Also, AP.RecNo is set to the record number of the first key in the index.
  3297.    'error
  3298. See: EqualKeyXBsrc
  3299. ~EqualKeyXBsrc
  3300. Func: EqualKeyXB       Pack: AccessPack         Func:  41/Mid-level
  3301. DIM AP AS AccessPack
  3302. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3303.                                 'passed key to find, start with enum=0
  3304. TempStr = FindKey$ + CHR$(0) + CHR$(0) + CHR$(0) '2 enumerator bytes + 0-term
  3305. AP.Func = EqualKeyXB            'defined in BULLET.BI
  3306. AP.Handle = indexfile           'handle to index file to find key from
  3307. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3308. AP.KeyPtrSeg = VARSEG(TempStr)
  3309. stat = BULLET(AP)
  3310. IF stat = 0 THEN
  3311.    'the key matched exactly (including enumerator, if present)
  3312.    'TempStr is NOT ALTERED
  3313.    'AP.RecNo is set to the record number of that key
  3314. ELSEIF stat = 200 THEN
  3315.    AP.Func = NextKeyXB          'if not found, get following key and check the
  3316.    stat = BULLET(AP)            'key proper (key less the enumerator bytes)
  3317.    IF stat = 0 THEN             '(i.e., it may be proper key but enumerator=1)
  3318.       'see NextKeyXBsrc for continuation
  3319. See: NextKeyXBsrc
  3320. ~NextKeyXBsrc
  3321. Func: NextKeyXB        Pack: AccessPack         Func:  42/Mid-level
  3322. 'see EqualKeyXBsrc for preliminary code
  3323. AP.Func = NextKeyXB             'defined in BULLET.BI
  3324. stat = BULLET(AP)               'KEYLEN assumed to equal actual key length...
  3325. IF stat = 0 THEN                '...as returned by StatKXB
  3326.     IF IndexFileIsNotUnique THEN
  3327.        IF LEFT$(TempStr,KeyLen-2) = FindKey$ THEN 'the next key matches!
  3328.                                                   '(except for the enumerator)
  3329. This code example follows up on the EqualKeyXBsrc example. See EqualKeyXB for
  3330. more information on finding partial keys.
  3331. See: PrevKeyXBsrc  EqualKeyXBsrc
  3332. ~PrevKeyXBsrc
  3333. Func: PrevKeyXB        Pack: AccessPack         Func:  43/Mid-level
  3334. DIM AP AS AccessPack
  3335. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3336. 'assume code has already executed to locate a key--this code then gets the key
  3337. 'before that one
  3338. AP.Func = PrevKeyXB             'defined in BULLET.BI
  3339. AP.Handle = indexfile           'handle to index file to access key from
  3340. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3341. AP.KeyPtrSeg = VARSEG(TempStr)  '(the prev key is read from disk and put here)
  3342. stat = BULLET(AP)
  3343. IF stat = 0 THEN
  3344.    'TempStr is filled in with the key (for as many bytes as the key length).
  3345.    'Also, AP.RecNo is set to the record number of the key.
  3346.    'error
  3347. See: LastKeyXBsrc
  3348. ~LastKeyXBsrc
  3349. Func: LastKeyXB        Pack: AccessPack         Func:  44/Mid-level
  3350. DIM AP AS AccessPack
  3351. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3352. AP.Func = LastKeyXB             'defined in BULLET.BI
  3353. AP.Handle = indexfile           'handle to index file to access key from
  3354. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3355. AP.KeyPtrSeg = VARSEG(TempStr)  '(the last key is read from disk and put here)
  3356. stat = BULLET(AP)
  3357. IF stat = 0 THEN
  3358.    'TempStr is filled in with the key (for as many bytes as the key length)
  3359.    'AP.RecNo is set to the record number of the last key.
  3360.    'error
  3361. See: StoreKeyXBsrc
  3362. ~StoreKeyXBsrc
  3363. Func: StoreKeyXB       Pack: AccessPack         Func:  45/Mid-level
  3364. DIM AP AS AccessPack
  3365. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3366. 'Assume record has been added to data file (AddRecordXB, returning RecNo2Use)
  3367. 'and key has been built (BuildKeyXB returning KeyToAdd$).
  3368.               
  3369. TempStr = KeyToAdd$ + CHR$(0)   'add the key to a UNIQUE index file
  3370. AP.Func = StoreKeyXB            'defined in BULLET.BI
  3371. AP.Handle = indexfile           'handle to index file to insert key into
  3372. AP.RecNo = RecNo2Use            'associate this record number with key
  3373. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3374. AP.KeyPtrSeg = VARSEG(TempStr)  '(the last key is read from disk and put here)
  3375. stat = BULLET(AP)
  3376. IF stat = 0 THEN
  3377.    'key added
  3378. ELSEIF stat = 201 THEN
  3379.    'key already exists, which means you need to construct a unique enumerator--
  3380.    'provided the file wasn't created for UNIQUE keys...INSTEAD USE InsertXB!
  3381. See: DeleteKeyXBsrc  InsertXB
  3382. ~DeleteKeyXBsrc
  3383. Func: DeleteKeyXB      Pack: AccessPack         Func:  46/Mid-level
  3384. DIM AP AS AccessPack
  3385. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3386. TempStr = KeyToDelete$ + CHR$(0)   'delete the key from a UNIQUE index file
  3387.                                    '(else need to supply enumerator also)
  3388. AP.Func = DeleteKeyXB           'defined in BULLET.BI
  3389. AP.Handle = indexfile           'handle to index file of key to delete
  3390. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3391. AP.KeyPtrSeg = VARSEG(TempStr)  '(this key is searched for exactly)
  3392. stat = BULLET(AP)               'if exact match found the key is deleted!
  3393. IF stat = 0 THEN
  3394.    'key deleted permanently
  3395. ELSEIF stat = 200 THEN
  3396.    'key as stated was not in the index file--if the index is not UNQIUE then
  3397.    'you must supply the exact enumerator along with the key proper to delete
  3398.    '--you can use the CurrentKeyXB routine to obtain the exact current key
  3399.    'other error
  3400. See: BuildKeyXBsrc
  3401. ~BuildKeyXBsrc
  3402. Func: BuildKeyXB       Pack: AccessPack         Func:  47/Mid-level
  3403. DIM AP AS AccessPack
  3404. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3405. 'Assume record has been built and is ready to be added to the data file. The
  3406. 'record is in the variable RecBuff (a fixed-length TYPE variable, typically).
  3407. AP.Func = BuildKeyXB            'defined in BULLET.BI
  3408. AP.Handle = indexfile           'handle to index file key is to be built for
  3409. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to data record buffer
  3410. AP.RecPtrSeg = VARSEG(RecBuff)
  3411. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3412. AP.KeyPtrSeg = VARSEG(TempStr)  '(the built key is put here)
  3413. stat = BULLET(AP)
  3414. IF stat = 0 THEN
  3415.    'key built okay so can do a AddRecordXB followed by a StoreKeyXB
  3416.    'but, again, InsertXB takes care of all this detail and then some--use it
  3417.    'error
  3418. See: CurrentKeyXBsrc
  3419. ~CurrentKeyXBsrc
  3420. Func: CurrentKeyXB     Pack: AccessPack         Func:  48/Mid-level
  3421. DIM AP AS AccessPack
  3422. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3423. AP.Func = CurrentKeyXB          'defined in BULLET.BI
  3424. AP.Handle = indexfile           'handle to index file
  3425. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3426. AP.KeyPtrSeg = VARSEG(TempStr)  '(the current key is put here)
  3427. stat = BULLET(AP)
  3428. IF stat = 0 THEN
  3429.    'TempStr set to current key (valid only for KeyLen bytes)
  3430.    'Also, AP.RecNo is set to the record number of the key.
  3431.    'error
  3432. See: GetFirstXBsrc
  3433. ~GetFirstXBsrc
  3434. Func: GetFirstXB       Pack: AccessPack         Func:  60/High-level
  3435. DIM AP AS AccessPack
  3436. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3437. DIM RecBuff AS RecordTYPE       'see AddRecordXBsrc for record layout
  3438. AP.Func = GetFirstXB            'defined in BULLET.BI
  3439. AP.Handle = indexhandle         'handle to index file to access key from
  3440. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to record buffer
  3441. AP.RecPtrSeg = VARSEG(RecBuff)  '(the record indexed by the key is put here)
  3442. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3443. AP.KeyPtrSeg = VARSEG(TempStr)  '(the first key is read from disk and put here)
  3444. stat = BULLET(AP)
  3445. IF stat = 0 THEN
  3446.    'TempStr is filled in with the key (for as many bytes as the key length)
  3447.    'RecBuff is filled in with the data record
  3448.    'AP.RecNo is set to the record number of the first key in the index.
  3449.    'error
  3450. See: GetEqualXBsrc
  3451. ~GetEqualXBsrc
  3452. Func: GetEqualXB       Pack: AccessPack         Func:  61/High-level
  3453. DIM AP AS AccessPack
  3454. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3455. DIM RecBuff AS RecordTYPE       'see AddRecordXBsrc for record layout
  3456.                                 'passed key to find, start with enum=0
  3457. TempStr = FindKey$ + CHR$(0) + CHR$(0) + CHR$(0) '2 enumerator bytes + 0-term
  3458. AP.Func = GetEqualXB            'defined in BULLET.BI
  3459. AP.Handle = indexfile           'handle to index file to find key from
  3460. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to record buffer
  3461. AP.RecPtrSeg = VARSEG(RecBuff)  '(the record indexed by the key is put here)
  3462. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3463. AP.KeyPtrSeg = VARSEG(TempStr)
  3464. stat = BULLET(AP)
  3465. IF stat = 0 THEN
  3466.    'RecBuff, and AP.RecNo filled as expected (TempStr remains the same)
  3467. ELSEIF stat = 200 THEN
  3468.    AP.Func = GetNextXB          'if not found, can get following key--the next
  3469.    stat = BULLET(AP)            'key would logically follow the key not found
  3470.                                 '--this let's you search based on partial keys
  3471. See: GetNextXBsrc
  3472. ~GetNextXBsrc
  3473. Func: GetNextXB        Pack: AccessPack         Func:  62/High-level
  3474. DIM AP AS AccessPack
  3475. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3476. DIM RecBuff AS RecordTYPE       'see AddRecordXBsrc for record layout
  3477. AP.Func = GetFirstXB            'defined in BULLET.BI
  3478. AP.Handle = indexhandle         'handle to index file to access key from
  3479. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to record buffer
  3480. AP.RecPtrSeg = VARSEG(RecBuff)  '(the record indexed by the key is put here)
  3481. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3482. AP.KeyPtrSeg = VARSEG(TempStr)  '(the first key is read from disk and put here)
  3483. stat = BULLET(AP)
  3484. DO WHILE stat = 0               'print all records in key order
  3485.    PRINT AP.RecNo; RecBuff.code; ", "; RecBuff.bday
  3486.    AP.Func = GetNextXB
  3487.    stat = BULLET(AP)
  3488. IF stat <> 202 THEN             'error 202 means end of file (expected)
  3489.    'error other than expected EOF
  3490. See: GetPrevXBsrc
  3491. ~GetPrevXBsrc
  3492. Func: GetPrevXB        Pack: AccessPack         Func:  63/High-level
  3493. DIM AP AS AccessPack
  3494. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3495. DIM RecBuff AS RecordTYPE       'see AddRecordXBsrc for record layout
  3496. AP.Func = GetLastXB             'defined in BULLET.BI
  3497. AP.Handle = indexhandle         'handle to index file to access key from
  3498. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to record buffer
  3499. AP.RecPtrSeg = VARSEG(RecBuff)  '(the record indexed by the key is put here)
  3500. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3501. AP.KeyPtrSeg = VARSEG(TempStr)  '(the last key is read from disk and put here)
  3502. stat = BULLET(AP)
  3503. DO WHILE stat = 0               'print all records in REVERSE key order
  3504.    PRINT AP.RecNo; RecBuff.code; ", "; RecBuff.bday
  3505.    AP.Func = GetPrevXB
  3506.    stat = BULLET(AP)
  3507. IF stat <> 203 THEN             'error 203 means top of file (expected)
  3508.    'error other than expected TOF
  3509. See: GetLastXBsrc
  3510. ~GetLastXBsrc
  3511. Func: GetLastXB        Pack: AccessPack         Func:  64/High-level
  3512. DIM AP AS AccessPack
  3513. DIM TempStr AS STRING * 64      'used as fixed-length string for VARPTR()
  3514. DIM RecBuff AS RecordTYPE       'see AddRecordXBsrc for record layout
  3515. AP.Func = GetLastXB             'defined in BULLET.BI
  3516. AP.Handle = indexhandle         'handle to index file to access key from
  3517. AP.RecPtrOff = VARPTR(RecBuff)  'far pointer to record buffer
  3518. AP.RecPtrSeg = VARSEG(RecBuff)  '(the record indexed by the key is put here)
  3519. AP.KeyPtrOff = VARPTR(TempStr)  'far pointer to key buffer
  3520. AP.KeyPtrSeg = VARSEG(TempStr)  '(the last key is read from disk and put here)
  3521. stat = BULLET(AP)
  3522. IF stat = 0 THEN
  3523.    'TempStr is filled in with the key (for as many bytes as the key length)
  3524.    'RecBuff is filled in with the data record
  3525.    'AP.RecNo is set to the record number of the last key in the index.
  3526.    'error
  3527. See: InsertXBsrc
  3528. ~InsertXBsrc
  3529. Func: InsertXB         Pack: AccessPack         Func:  65/High-level
  3530. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3531.                                 'TempStr and RecBuff previously defined
  3532. FOR i = 1 TO 3                  '3=number of related indexes to maintain
  3533.    AP(i).Func = InsertXB
  3534.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3535.    AP(i).RecPtrOff = VARPTR(RecBuff) 
  3536.    AP(i).RecPtrSeg = VARSEG(RecBuff) 
  3537.  see AddRecordXBsrc for RecBuff TYPE 
  3538.    AP(i).KeyPtrOff = VARPTR(TempStr) 
  3539. (be sure you reserved the tag field) 
  3540.    AP(i).KeyPtrSeg = VARSEG(TempStr) 
  3541.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3542.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))   'AP(1 TO 4) to avoid subscript error
  3543. AP(3).NextPtrOff = 0            'reset last access pack to end-link value
  3544. AP(3).NextPtrSeg = 0
  3545. stat = BULLET(AP(1))
  3546. IF stat = 0 THEN                'if stat=0 must still check AP(1).Stat
  3547.    IF AP(1).Stat <> 0 THEN      'error when adding data record
  3548.    TrueError = AP(stat).Stat    'the returned stat is array index of bad pack
  3549. See: UpdateXBsrc
  3550. ~UpdateXBsrc
  3551. Func: UpdateXB         Pack: AccessPack         Func:  66/High-level
  3552. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3553.                                 'TempStr and RecBuff previously defined
  3554. FOR i = 1 TO 3                  '3=number of related indexes to maintain
  3555.    AP(i).Func = UpdateXB
  3556.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3557.    AP(i).RecNo = RecordNumberToUpdate&    'tell it which record to update
  3558.    AP(i).RecPtrOff = VARPTR(RecBuff)      'RecBuff has new, updated data
  3559.    AP(i).RecPtrSeg = VARSEG(RecBuff)
  3560.    AP(i).KeyPtrOff = VARPTR(TempStr)
  3561.    AP(i).KeyPtrSeg = VARSEG(TempStr)
  3562.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3563.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))   'AP(1 TO 4) to avoid subscript error
  3564. AP(3).NextPtrOff = 0 : AP(3).NextPtrSeg = 0 'reset last access pack to 0
  3565. stat = BULLET(AP(1))
  3566. IF stat = 0 THEN                'if stat=0 must still check AP(1).Stat
  3567.    IF AP(1).Stat <> 0 THEN      'error when writing data record
  3568.    TrueError = AP(stat).Stat    'the returned stat is array index of bad pack
  3569. See: ReindexXBsrc
  3570. ~ReindexXBsrc
  3571. Func: ReindexXB        Pack: AccessPack         Func:  67/High-level
  3572. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3573.                                 'DIM'd to 4 to avoid bad subscript in loop
  3574. FOR i = 1 TO 3                  '3=number of related indexes to reindex
  3575.    AP(i).Func = ReindexXB
  3576.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3577.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3578.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))   'AP(1 TO 4) to avoid subscript error
  3579. AP(3).NextPtrOff = 0
  3580. AP(3).NextPtrSeg = 0            'reset last access pack to end-link value
  3581. stat = BULLET(AP(1))
  3582. IF stat THEN                    'if stat <> 0 then the...
  3583.    TrueError = AP(stat).Stat    '...returned stat is array index of bad pack
  3584. The reason AP() is REDIM AP(1 TO 4) is so that the AP(i + 1) in the code loop
  3585. doesn't create an invalid subscript error.                                   
  3586. See: LockXBsrc
  3587. ~LockXBsrc
  3588. Func: LockXB           Pack: AccessPack         Func:  80/Network
  3589. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3590.                                 'DIM'd to 4 to avoid bad subscript in loop
  3591. FOR i = 1 TO 3                  '3=number of related indexes to Lock
  3592.    AP(i).Func = LockXB
  3593.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3594.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3595.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))
  3596. NEXT                            'data file handle known internally by BULLET
  3597. AP(3).NextPtrOff = 0
  3598. AP(3).NextPtrSeg = 0            'reset last access pack to end-link value
  3599. stat = BULLET(AP(1))
  3600. IF stat > 3 THEN                'if stat > 3 (> number of packs) then the...
  3601.    TrueError = AP(3).Stat       '...lock failed on the data file
  3602. ELSEIF stat <> 0 THEN                                          (|last ReadKHXB)
  3603.    TrueError = AP(stat).Stat    '...lock failed on index file # stat
  3604. The Lock routines use a different method to identify the bad pack when the   
  3605. failure was caused by the data file. See above.                              
  3606. See: UnlockXBsrc
  3607. ~UnlockXBsrc
  3608. Func: UnlockXB         Pack: AccessPack         Func:  81/Network
  3609. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3610.                                 'DIM'd to 4 to avoid bad subscript in loop
  3611. FOR i = 1 TO 3                  '3=number of related indexes to Lock
  3612.    AP(i).Func = UnlockXB
  3613.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3614.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3615.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))
  3616. NEXT                            'data file handle known internally by BULLET
  3617. AP(3).NextPtrOff = 0
  3618. AP(3).NextPtrSeg = 0            'reset last access pack to end-link value
  3619. stat = BULLET(AP(1))
  3620. IF stat > 3 THEN                'if stat > 3 (> number of packs) then the...
  3621.    TrueError = AP(3).Stat       '...unlock failed on the data file
  3622. ELSEIF stat <> 0 THEN
  3623.    TrueError = AP(stat).Stat    '...unlock failed on index file # stat
  3624. The Lock routines use a different method to identify the bad pack when the   
  3625. failure was caused by the data file. See above.                              
  3626. See: LockKeyXBsrc
  3627. ~LockKeyXBsrc
  3628. Func: LockKeyXB        Pack: AccessPack         Func:  82/Network
  3629. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3630.                                 'DIM'd to 4 to avoid bad subscript in loop
  3631. FOR i = 1 TO 3                  '3=number of related indexes to Lock
  3632.    AP(i).Func = LockXB
  3633.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3634.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3635.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))
  3636. AP(3).NextPtrOff = 0
  3637. AP(3).NextPtrSeg = 0            'reset last access pack to end-link value
  3638. stat = BULLET(AP(1))
  3639. IF stat <> 0 THEN
  3640.    TrueError = AP(stat).Stat    'lock failed on index file # stat
  3641.                                 '--if stat > 3 then failed on last internal
  3642.                                 '--ReadKHXB...This is EXTREMELY unlikely
  3643. See: UnlockKeyXBsrc
  3644. ~UnlockKeyXBsrc
  3645. Func: UnlockKeyXB      Pack: AccessPack         Func:  83/Network
  3646. REDIM AP(1 TO 4) AS AccessPack  'array of 3 access packs, 1 for each index file
  3647.                                 'DIM'd to 4 to avoid bad subscript in loop
  3648. FOR i = 1 TO 3                  '3=number of related indexes to Lock
  3649.    AP(i).Func = UnlockKeyXB
  3650.    AP(i).Handle = indexhandle(i)          'each index file's handle
  3651.    AP(i).NextPtrOff = VARPTR(AP(i + 1))   'point to NEXT access pack
  3652.    AP(i).NextPtrSeg = VARSEG(AP(i + 1))
  3653. AP(3).NextPtrOff = 0
  3654. AP(3).NextPtrSeg = 0            'reset last access pack to end-link value
  3655. stat = BULLET(AP(1))
  3656. IF stat <> 0 THEN
  3657.    TrueError = AP(stat).Stat    'unlock failed on index file # stat
  3658. See: LockDataXBsrc
  3659. ~LockDataXBsrc
  3660. Func: LockDataXB       Pack: AccessPack         Func:  84/Network
  3661. DIM AP AS AccessPack
  3662. AP.Func = LockDataXB            'defined in BULLET.BI
  3663. AP.Handle = datahandle          'handle of data file to lock
  3664. stat = BULLET(AP)
  3665. IF stat THEN 'error
  3666. See: UnlockDataXBsrc
  3667. ~UnlockDataXBsrc
  3668. Func: UnlockDataXB     Pack: AccessPack         Func:  85/Network
  3669. DIM AP AS AccessPack
  3670. AP.Func = UnlockDataXB          'defined in BULLET.BI
  3671. AP.Handle = datahandle          'handle of data file to unlock
  3672. stat = BULLET(AP)
  3673. IF stat THEN 'error
  3674. See: DriveRemoteXBsrc
  3675. ~DriveRemoteXBsrc
  3676. Func: DriveRemoteXB    Pack: RemotePack         Func:  86/Network
  3677. DIM RP AS RemotePack
  3678. RP.Func = DriveRemoteXB         'defined in BULLET.BI
  3679. RP.Handle = drive2check         'drive to check (0=default, 1=A:,2=B:,3=C:...)
  3680. stat = BULLET(RP)
  3681. IF stat = 0 THEN
  3682.    'RP.IsRemote set to 0 if drive local, 1 if remote
  3683.    'RP.Flags set to DX register as returned by DOS
  3684.    'RP.IsShare set to 0 if SHARE.EXE is not loaded, non-zero SHARE installed
  3685.   'error  (like invalid drive)
  3686. See: FileRemoteXBsrc
  3687. ~FileRemoteXBsrc
  3688. Func: FileRemoteXB     Pack: RemotePack         Func:  87/Network
  3689. DIM RP AS RemotePack
  3690. RP.Func = FileRemoteXB          'defined in BULLET.BI
  3691. RP.Handle = filehandle          'file handle to check
  3692. stat = BULLET(RP)
  3693. IF stat = 0 THEN
  3694.    'RP.IsRemote set to 0 if file local, 1 if remote
  3695.    'RP.Flags set to DX register as returned by DOS
  3696.    'RP.IsShare set to 0 if SHARE.EXE is not loaded, non-zero SHARE installed
  3697.   'error  (like invalid handle)
  3698. See: SetRetriesXBsrc
  3699. ~SetRetriesXBsrc
  3700. Func: SetRetriesXB     Pack: SetRetriesPack     Func:  88/Network
  3701. DIM SRP AS SetRetriesPack
  3702. SRP.Func = SetRetriesXB
  3703. SRP.Mode = 1             '1=set to user values, 0=set DOS default
  3704. SRP.Pause = 5000         'do 5,000 loops between retries
  3705. SRP.Retries = 5          'try 5 times before giving up with error
  3706. stat = BULLET(SRP)
  3707. IF stat THEN
  3708.    'error                'it's unlikely an error occurs
  3709. See: DeleteFileDOSsrc
  3710. ~DeleteFileDOSsrc
  3711. Func: DeleteFileDOS    Pack: DOSFilePack        Func: 100/DOS
  3712. DIM DFP AS DOSFilePack
  3713. DIM TempStr AS STRING * 80
  3714. TempStr = file2delete$ + CHR$(0)
  3715. DFP.Func = DeleteFileDOS        'defined in BULLET.BI
  3716. DFP.FilenamePtrOff = VARPTR(TempStr)
  3717. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3718. stat = BULLET(DFP)
  3719. IF stat THEN 'error
  3720. See: RenameFileDOSsrc
  3721. ~RenameFileDOSsrc
  3722. Func: RenameFileDOS    Pack: DOSFilePack        Func: 101/DOS
  3723. DIM DFP AS DOSFilePack
  3724. DIM TempStr AS STRING * 80
  3725. DIM TempStr2 AS STRING * 80
  3726. TempStr = file2rename$ + CHR$(0)
  3727. TempStr2 = newfilename$ + CHR$(0)
  3728. DFP.Func = RenameFileDOS        'defined in BULLET.BI
  3729. DFP.FilenamePtrOff = VARPTR(TempStr)
  3730. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3731. DFP.NewNamePtrOff = VARPTR(TempStr2)
  3732. DFP.NewNamePtrSeg = VARSEG(TempStr2)
  3733. stat = BULLET(DFP)
  3734. IF stat THEN 'error
  3735. See: CreateFileDOSsrc
  3736. ~CreateFileDOSsrc
  3737. Func: CreateFileDOS    Pack: DOSFilePack        Func: 102/DOS
  3738. DIM DFP AS DOSFilePack
  3739. DIM TempStr AS STRING * 80
  3740. TempStr = file2create$ + CHR$(0)
  3741. DFP.Func = CreateFileDOS        'defined in BULLET.BI
  3742. DFP.FilenamePtrOff = VARPTR(TempStr)
  3743. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3744. DFP.Attr = 0                    'normal file directory attribute
  3745. stat = BULLET(DFP)
  3746. IF stat THEN 'error
  3747. See: AccessFileDOSsrc
  3748. ~AccessFileDOSsrc
  3749. Func: AccessFileDOS    Pack: DOSFilePack        Func: 103/DOS
  3750. DIM DFP AS DOSFilePack
  3751. DIM TempStr AS STRING * 80
  3752. TempStr = file2access$ + CHR$(0)
  3753. DFP.Func = AccessFileDOS        'defined in BULLET.BI
  3754. DFP.FilenamePtrOff = VARPTR(TempStr)
  3755. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3756. DFP.ASmode = &H42               'attempt R/W DENY NONE access
  3757. stat = BULLET(DFP)
  3758. IF stat THEN 'error
  3759. See: OpenFileDOSsrc
  3760. ~OpenFileDOSsrc
  3761. Func: OpenFileDOS      Pack: DOSFilePack        Func: 104/DOS
  3762. DIM DFP AS DOSFilePack
  3763. DIM TempStr AS STRING * 80
  3764. TempStr = file2open$ + CHR$(0)
  3765. DFP.Func = OpenFileDOS          'defined in BULLET.BI
  3766. DFP.FilenamePtrOff = VARPTR(TempStr)
  3767. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3768. DFP.ASmode = &H42               'open in R/W DENY NONE access
  3769. stat = BULLET(DFP)
  3770. IF stat = 0 THEN
  3771.    'DFP.Handle set to handle of open file
  3772.    'error
  3773. See: SeekFileDOSsrc
  3774. ~SeekFileDOSsrc
  3775. Func: SeekFileDOS      Pack: DOSFilePack        Func: 105/DOS
  3776. DIM DFP AS DOSFilePack
  3777. DFP.Func = SeekFileDOS          'defined in BULLET.BI
  3778. DFP.Handle = handle
  3779. DFP.SeekOffset = 0&             'position 0 relative EOF (get length of file)
  3780. DFP.Method = 2                  'seek from END of file
  3781. stat = BULLET(DFP)
  3782. IF stat = 0 THEN
  3783.    'DFP.SeekOffset set to absolute current offset
  3784.    '--in this case, the DFP.SeekOffset equals then length of the file
  3785.    'error
  3786. See: ReadFileDOSsrc
  3787. ~ReadFileDOSsrc
  3788. Func: ReadFileDOS      Pack: DOSFilePack        Func: 106/DOS
  3789. DIM DFP AS DOSFilePack
  3790. DIM ReadBuff AS STRING * 512    'sector buffer
  3791. DFP.Func = ReadFileDOS          'defined in BULLET.BI
  3792. DFP.Handle = handle
  3793. DFP.Bytes = Bytes2Read          '16-bit value, in this case 512 since that's
  3794. DFP.BufferPtrOff = VARPTR(ReadBuff)            'the size of ReadBuff
  3795. DFP.BufferPtrSeg = VARSEG(ReadBuff)
  3796. stat = BULLET(DFP)
  3797. IF stat = 0 THEN
  3798.    IF DFP.Bytes <> Bytes2Read THEN              'check if EOF processed
  3799.       'hit EOF before reading all 512 bytes
  3800.    ELSE
  3801.       'ReadBuff filled with 512 bytes of data read from the current disk pos
  3802.       'disk position moved to the last byte read + 1
  3803.    ENDIF
  3804.    'error
  3805. See: ExpandFileDOSsrc
  3806. ~ExpandFileDOSsrc
  3807. Func: ExpandFileDOS    Pack: DOSFilePack        Func: 107/DOS
  3808. DIM DFP AS DOSFilePack
  3809. DFP.Func =  ExpandFileDOS       'defined in BULLET.BI
  3810. DFP.Handle = handle
  3811. DFP.SeekOffset = Bytes2ExpandBy&
  3812. stat = BULLET(DFP)
  3813. IF stat = 0 THEN
  3814.    'file expanded by number of bytes specified
  3815.    'error
  3816. See: WriteFileDOSsrc
  3817. ~WriteFileDOSsrc
  3818. Func: WriteFileDOS     Pack: DOSFilePack        Func: 108/DOS
  3819. DIM DFP AS DOSFilePack
  3820. DIM WriteBuff AS STRING * 512   'sector buffer
  3821. DFP.Func = WriteFileDOS         'defined in BULLET.BI
  3822. DFP.Handle = handle
  3823. DFP.Bytes = Bytes2Write         '16-bit value, in this case 512 since that's
  3824. DFP.BufferPtrOff = VARPTR(WriteBuff)           'the size of WriteBuff
  3825. DFP.BufferPtrSeg = VARSEG(WriteBuff)
  3826. stat = BULLET(DFP)
  3827. IF stat = -2 THEN
  3828.    'disk full
  3829. ELSE IF stat THEN
  3830.    'other error
  3831.    'okay
  3832. Unlike ReadFileDOS, if the number of bytes actually written does not equal
  3833. Bytes2Write, the WriteFileDOS routine returns a DISK FULL error code (-2).
  3834. See: CloseFileDOSsrc
  3835. ~CloseFileDOSsrc
  3836. Func: CloseFileDOS     Pack: DOSFilePack        Func: 109/DOS
  3837. DIM DFP AS DOSFilePack
  3838. DFP.Func = CloseFileDOS         'defined in BULLET.BI
  3839. DFP.Handle =handle2close
  3840. stat = BULLET(DFP)
  3841. IF stat THEN 'error
  3842. See: MakeDirDOSsrc
  3843. ~MakeDirDOSsrc
  3844. Func: MakeDirDOS       Pack: DOSFilePack        Func: 110/DOS
  3845. DIM DFP AS DOSFilePack
  3846. DIM TempStr AS STRING * 80
  3847. TempStr = subdir2make$ + CHR$(0)
  3848. DFP.Func = MakeDirDOS           'defined in BULLET.BI
  3849. DFP.FilenamePtrOff = VARPTR(TempStr)
  3850. DFP.FilenamePtrSeg = VARSEG(TempStr)
  3851. stat = BULLET(DFP)
  3852. IF stat THEN 'error
  3853. See: DeleteFileDOSsrc
  3854.